There is some voodoo-talk in the answers around here among good ideas. Let's try to be a bit more real about what's happening and sum up the good stuff to check:
Basically, when that happens, it is a good idea to enable verbose mode for AVRDUDE, to get a better idea of what's happening. To do so, you only need to go in the preferences and check the verbose mode box. It's also a good idea to move away from the Arduino IDE, and launch a console to be more comfortable on reading AVRDUDE's output, that you'll get on clicking on the upload
button.
What's important here to put 3 or 4 -v
to the command call. Here's how looks like such AVRDUDE commands, with made up parameters as they are totally dependent on how the Arduino has been installed:
avrdude -v -v -v -v -C /path/to/avrdude.conf -patmega328 -P/dev/usbport -U flash:w:/path/to/firmware.hex
A good way to get the correct command line to use is to copy it from the verbose output of the Arduino IDE output log when verbosity has been enabled.
When you get avrdude: stk500_recv(): programmer is not responding
, it basically means that something wrong is happening, before the flashing actually begins.
Basically you have to check (from hardware to software, low level to high level):
- if the cable and/or connectors does not have microcuts;
- if no solder points are short circuiting (i.e. touching something metallic around), that means:
- if there is no short circuit on the PCB between
Rx
and Tx
(usually pins 1
and 0
);
- if there is no contact with a metallic element below the board, or tiny bits between a component's legs (like the FTDI, the ATmega chip or any other);
- if the ATmega chip is not out of power (GND/VCC shortcut or cut or VCC input being dead…);
- if the
1
and 0
pins of the Arduino are not being used by some shield or custom design (/!\
does not apply to the Leonardo as it has independent USB handling);
- if the USB to UART converter does not have a problem (
FTDI
on older Duemilanove or ATmega16U2 on newer Arduino Unos);
- if the ATmega328 chip is fried or wrongly installed;
- if the bootloader has been overwritten or is failing;
- if the right baudrate is applied for entering the bootloader;
- if the right settings are set for the target microcontroller and Board;
Usually the avrdude -v -v -v -v
can help a lot find at which stage it is failing. Whether it can't make a USB connection at all (cable failing, USB/UART, PCB…), or it is a bootloader problem.
Update: I tried turning the onboard ATmega and fitting it in the other direction. Now, I encounter no problems uploading, but nothing happens afterwards. The onboard LED also does not seem to be blinking.
I'm afraid that if you reversed the position of the ATmega, and then it does not work, the fact that you placed the power source on digital pins may have burnt your chip.