I have an Arduino Mega 1280 that would not load sketches. The problem came on in the middle of a complicated project. I kept loading code with changes and suddenly my changes never took effect. I saw timeout error messages instead of program load messages.
I abandoned the project for 2 years and came back and fixed it this week. The solution is I used a second Arduino as a in circuit programmer.
My Mega needed a bug fixed bootloader. A fresh copy of the Arduino development environment comes with fresh copies of all the bootloaders.
It took me 5 evenings to get this to work. Here is how to program a second Arduino as an In Circuit Programmer, hook it up to the target computer and install a new copy of the bootloader.
Here is the Arduino CC reference page that explains the four important programming lines.
Here is a Sparkfun tutorial page that walks you through most of the process.
Get a second working Arduino, plug it in and load this Arduino with a sketch called: Examples->ArduinoISP.
Read the sketch and double check that Pin 10 is the SS or Slave select line.
Unplug the Arduino as ISP and set the “target” Arduino next to it.
Now get 6 nice long jumper wires.
Get a sheet of paper and draw a picture so each wire goes where it should:
With power off, hook up these wires.
Red wire connect power between the two arduinos
Black wire connect ground.
(Power over USB was just fine for my work.)
The next three lines, use the above Arduino reference page to get pin numbers.
Color 1 MOSI Master out slave in
Color 2 MISO Master in slave out
Color 3 SC Clock
Color 4 SS slave select It goes from Pin 10 on the Arduino acting as an ISP to the pin labeled RESET on the Arduino Mega 1280
Now very very important. Get a magnifying glass and read the label on the CPU chip on the “target” Arduino.
The circuit board of an Arduino Mega doesn’t tell you if you have a 1280 or a 2560 chip.
Plug the USB Cable into the Arduino acting as an ISP. Both boards should light up.
Start the ./arduino development environment on your Linux, Windows PC or Mac
Under TOOLS -->BOARD → mark the Arduino Model for your “target”. You want “Board” to show “Mega 1280” .
Under TOOLS -->Programmer → mark “Arduino as ISP” .
It turns out, different models of the Arduino handle “reset” in slightly different ways. If the reset wire going to the “target” is not working. then you will see error messages like “avrdude timeout” and “avrdude no communication from …”. If you see “avrdude processor ID error, check settings or use -F” then you have the wrong setting under TOOLS–>BOARD
Best wishes. burning bootloaders is kind of scary at first. Just stay patient and use a sheet of paper to organize your work.