Upload Timeout Error on Mega 2560 - Not Sure What Changed

I have the same problem. I have a new Mega R3. I tried both Arduino 0022 and 1.0 on my Mac OSX 10.6.8. Sometime my sketch will upload fine, but most of the time it times out. Doing some Google searches, I found this seems to be a known problem, but I'm not sure how to fix it. I've seen some talk about avrdude, but I don't know anything about fixing, compiling and uploading a boot loader. Since this problem seems to be kind of old and my hardware and software are new, I'm surprised this problem still exists. What should I do?

Moi aussi. But I can upload with Parallels PC emulator running Windows XP on my MAC but not my actual MAC.

Having tested alot with this problem, i found this:

Whenever i have string in my sketch which has threee marksigns in a string (eg: "!!!"), my sketch will make the Mega2560 timeout when uploading ("huh?..bootloader>" hex code message followed after multiple retries by avrdude: stk500v2_ReceiveMessage(): timeout ). Using Windows 2008 R2 Server (think Win7 64 will do the same), Arduino IDE 1.0 & Arduino Mega2560 compatible.

Here's a sample sketch to reproduce the error:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println("!!!");
}

Hopefully this will help.

deajan

Thanks, that solved the problem for me. I'm running Mac OS X 10.7.3, Arduino IDE 1.0 & Arduino Mega ADK r1.

Thanks to Michael635 for showing that replacing the AVR directory from rev-0023 solves the problem. It solved mine! Anders

@aefields

I was having this problem too. Luckily I hadn't erased my old 0022 program. Going back to that fixed the problem. I really ought to remember: "Never update a program that works!"

Very true! ;)

I had the same problem and just fixed it by doing that exactly. Now, it works fine. Thank you! 8)

I also renamed all of my sketches from *.ino to *.pde.

would anybody care to speculate why I am unable to upload a sketch which produces an object of approximately 36k when I can upload an object of 34k? I have been working with windows XP and arduino 1.0 for several weeks now and today my the object grew to just over 36k. Now I cannot upload it. I can upload the program when I'm using Linux with arduino-1.0 (downloaded from the git repository over 2 months ago) but none of the windows boxes will upload it. We are using Windows XP and Windows 2003 server with no luck... HELP!? please. Thanks

It would really help if you said what the error was rather than the vague phrase "unable to upload".

Did you add a string that contains three or more '!' in a row?

sorry for not being more explicit. The upload just hangs, no error messages, no output, it just never finishes. If I use my Debian Linux machine, it works fine. If I reduce the size of the sketch, it works fine. But my sketch of 36742 bytes wont upload. As I watch the lights on the Mega, it looks curiously as if the Mega is being reset right in the middle of the upload. THANKS FOR ANY HELP! Fred

Is there a solution to these sketch upload timeout errors yet? My older Mega works fine, as do all my other FTDI based 'duinos, but the Mega R3 is useless to me right now. Meh! Arduino 1.0 on MacOS 10.6.8 Maybe dumb question: is the Mega R3 programmable with a FTDI USB cable? John

I was having the same issue.

But end up I realized that I have place the reset switch A_RST_M at the wrong position. Correcting the switch position and my Arduino is now working well.

I just joined in to say that I have this same problem. This ruined at least three weekends for me. Instead of working on new projects, I am banging my head into the wall, trying everything to resolve this.

I have Mega 2560, R2l, on Win XP SP3. It constantly either hangs with timeout, or sometimes it tells me that COM port is taken by another application. I always either get timeout or port locked by other applicaiton.

So many Mega 2560 owners are having problems with this, that developers should definitely check this one out.

DROBNJAK:
I just joined in to say that I have this same problem. This ruined at least three weekends for me. Instead of working on new projects, I am banging my head into the wall, trying everything to resolve this.

I have Mega 2560, R2l, on Win XP SP3. It constantly either hangs with timeout, or sometimes it tells me that COM port is taken by another application. I always either get timeout or port locked by other applicaiton.

So many Mega 2560 owners are having problems with this, that developers should definitely check this one out.

I tottaly agree. But I can’t expect support because my sparkfun mega isn’t “official”…

For those of you having trouble, can you try changing "stk500v2" to "wiring" for the Mega 2560 in your boards.txt file (in the hardware/arduino sub-directory of your Arduino application directory)? That should tell avrdude to do an auto-reset of the board before the upload (in addition to the one done by the IDE itself), which might help.

See: http://code.google.com/p/arduino/issues/detail?id=806 for more information and updates.

Just wanted to add my voice to the chorus on this issue. I'm using a Mega 2560 R2 with Arduino 1.0.1 running on Mac OSX 10.6.8. Changing "stk500v2" to "wiring" has made no discernible difference.

As a few users on this thread and others have found, it has been a sudden behaviour change where I can't think of anything I've changed...

EDIT: to add a couple more details:

  • The sketch that is currently loaded still functions perfectly.
  • (non-)behaviour is seemingly identical in Arduino IDE 0022, 0023, and 1.01.

Josephiah: Just wanted to add my voice to the chorus on this issue. I'm using a Mega 2560 R2 with Arduino 1.0.1 running on Mac OSX 10.6.8. Changing "stk500v2" to "wiring" has made no discernible difference.

As a few users on this thread and others have found, it has been a sudden behaviour change where I can't think of anything I've changed...

+1

It sounds like there may be different things going on here, since some of you are seeing different symptoms / behaviors.

Josephiah and DROBNJAK, can you post the verbose output of an upload attempt? Have you tried a different USB cable? Are you going through a USB hub (if so, try connecting the board straight to the computer)?

if it helps, it doesn't work for me neither. Tried 2 pc-s and 2 cables. It all worked before (sometimes i didnt saw progress bar so i had to reconnect mega and it worked) but now i am stuck at 95% progress bar, and smtimes my L is on for the whole time, and sometimes not... cheers

mellis: Josephiah and DROBNJAK, can you post the verbose output of an upload attempt? Have you tried a different USB cable? Are you going through a USB hub (if so, try connecting the board straight to the computer)?

Hi Mellis, thanks for your help. Changing USB cable doesn't seem to make a difference, and it's plugged into the same USB port on my mac as it always has been. The results also appear to be the same whether I have the mega on its own with nothing else plugged in, or with a shield attached (I'm currently using it for a monome-like project).

Sometimes I get this:

Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P/dev/tty.usbmodem-chr-001 -b115200 -D -Uflash:w:/var/folders/Vd/VdFeGvFZG4Gc-qfuGxx6pE+++TI/-Tmp-/build893675159181048838.tmp/Blink.cpp.hex:i 

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

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/Jo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbmodem-chr-001
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0e] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0e] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [01] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

And sometimes this:

Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P/dev/tty.usbmodem-chr-001 -b115200 -D -Uflash:w:/var/folders/Vd/VdFeGvFZG4Gc-qfuGxx6pE+++TI/-Tmp-/build893675159181048838.tmp/Blink.cpp.hex:i 

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

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/Jo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbmodem-chr-001
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
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 : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: Recv: . [1b] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17] 
avrdude: ser_recv(): read error: Device not configured

(that last line from me unplugging the board.)

Cheers, Jo