Can no longer upload ANY sketches to Arduino Mega 2560 - timeout at upload

I have been uploading sketches to my Arduino Mega 2560 for quite some time now, but after uploading a new sketch, I am unable to upload anything at all, including blank setup() and loop() functions. When uploading, I get upload output (verbose) like this:

Binary sketch size: 678 bytes (of a 258048 byte maximum)
C:\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM4 -b115200 -D -Uflash:w:C:\Users\HP\AppData\Local\Temp\build2486111564331036727.tmp\BareMinimum.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM4
         Using Programmer              : stk500v2
         Overriding Baud Rate          : 115200
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0b] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [08] 
avrdude: Recv: A [41] 
avrdude: Recv: V [56] 
avrdude: Recv: R [52] 
avrdude: Recv: I [49] 
avrdude: Recv: S [53] 
avrdude: Recv: P [50] 
avrdude: Recv: _ [5f] 
avrdude: Recv: 2 [32] 
avrdude: Recv: t [74] 
avrdude: stk500v2_getsync(): found AVRISP programmer
         AVR Part                      : ATMEGA2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500V2
         Description     : Atmel STK500 Version 2.x firmware
         Programmer Model: AVRISP
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout

etc... (never gives up)

I have tried uploading the sketch from multiple computers (different OS's), and I even swapped out the Arduino. The new Arduino also refused to accept uploads after I uploaded my new sketch. I could try to upload onto a third, but I'd prefer to fix my two non-functional Arduinos first, and then I'll try to figure out why my code is breaking the Arduinos. If people think it would help, I could post the code, but it's very long and has mutliple .h and .cpp files.

I'm guessing the problem is with the bootloader, which I basically know nothing about. So if someone could point me in the right direction for fixing my Arduino, I'd really appreciate it.

Pass or fail?
http://arduino.cc/forum/index.php/topic,73748.0.html

Hah, no way. I just ran into the exact same problem and posted a thread about it right this second. I really hope somebody can help us figure this out. crosses fingers

Hah, no way.

Why.
You want to know what is wrong with your system you have to do some tests.

You could have blown up your board due to some electronic abuse. That test sees if the communications is working between the computer and USB adapter on the board. If that works then you can test the bootloader and see if it needs reprogramming or whether you throw it in the trash and get another one.

Both of my Arduinos pass the test.

OK so it looks like the boot loader might need re burning. If that dosn't work then the processor is goosed.

slourette:
Both of my Arduinos pass the test.

Two boards with the exact same problem?

Does the on-board LED (labeled L) blink a few times when you click the RESET button?

The LED blinks continuously at roughly 10Hz. Pressing the reset button simply interrupts the blinking. When i disconnect and reconnect the power, the LED blinks twice at roughly 2Hz before going back to its continuous 10Hz blinking.

I guess I'll get back to you once I've figured out how to burn the bootloader. Would anyone be interested in seeing the code that I believe ruins the bootloader? I would post it regardless, but it's quite lengthy (5 .h files, 2 .cpp files, 1 .ino file).

Yes please, zip it up an use the additional options drop down at the bottom of the box to attach it.

Here is the version of the code that i tried to upload the the Arduinos and caused them to become nonfunctional. My previous working version was all in one file and was a mess, but worked perfectly. I'm guessing the problem is either related to a bad pointer, or problems with the classes, since those were the things i just added. I also know that the program never made it out of setup, because the Serial.print functions aren't being called in my panel.RedrawDisplay() function (also the LCD isn't displaying anything).

EDIT: Somehow the attached file lost its extension. Just add a .zip to the end of it

freqsource-breaksarduinos (7.17 KB)

Try this...

• Start the Arduino IDE

• Load or create an empty sketch...

void setup( void ) { } void loop( void ) { }

• Connect the board to the computer

• Hold the RESET button

• Click Upload

• At the moment Uploading is displayed, release the RESET button

• If at first you don't succeed, try try again (try it a few times)

I am having the SAME issue onthesamehardware, although I have noled functionality. Mega R3. I blamed me though, and that i had ruined the hardware somehow. i base that theory on the 500 ma draw, and the fact the atmega chip was getting warm. could you verify that your chip is not getting warm? I think my issue is different, but if yours is hot too, maybe its less my fault.

i am running arduino IDE 1.0 on an ubuntu machine, been running the 1204 pre for some time.

I blamed me though, and that i had ruined the hardware somehow.

You can ruin the hardware by doing things like having an input button wired to a pin and ground, setting that pin to an output and high, then pushing the button. That puts a short circuit on the output pin and will cause overheating. But once the hardware is removed it should not get hot. If it gets hot with nothing attached then you have blown the chip by doing something like putting 12V on the +5V pin or something similar.

I fixed the problem by reading the bootloader from a working arduino, and uploading it to the non-functional ones with an AVRISP mkII. As for the the sketch that was causing the problem, I believe it was from dereferencing a null pointer, which was being interpreted as the address of an array. I still find it strange that I was able to write to the bootloader at runtime.

The processor physically can not change a program memory location unless it is running from the boot loader partition of the memory. The only thing I can think could have happened is that you some how jumped into the bootloader code at a some point and that the normal bootloader did the damage.
As I said code running insider the normal space can not write to program memory.