Upload Timeout Error on Mega 2560

Setup is:

a. Arduino Mega 2560 Rev 2 with ATMEGA8U2 USB-Serial controller IC.
b. Using arduino-1.0 on Windows 2000.
c. Board selected is Arduino Mega 2560 or Mega ADK
d. Arduino Mega 2560 (COM3) entry appears in Device Manager and IDE Tools->Serial Port is COM3 when USB cable is connected. Drive installed is "Arduino MEGA 2560.inf". Not "Arduino Mega ADK REV3.inf".
e. This is first time using board.
f. Using Blink program of Examples->Basic.
g. Verify/Compile of program is successful.

  1. The Green "ON" LED is on when the board is powered up.
  2. The "L" LED flashes when I power up the board (indicating that the bootloader is present).
  3. The Red "RX" LED flashes every 5 seconds once after IDE starts the upload. The "L" LED continues to flash.

Hold shift key while selecting File->Upload from menu.
No status output during first five minutes until following status is output:

avrdude: stk500v2_ReceiveMessage(): timeout
/* Above line repeated 6 more times /
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
/
Above line repeated 6 more times /
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
/
Above line repeated 6 more times /
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
/
Above line repeated 6 more times */
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x11
avrdude: stk500v2_disable(): failed to leave programming mode

  1. The Red "RX" LED contiues to flash every 5 seconds after IDE outputs above status info.

Any thoughts on what to do next?

Larry

Hi Larry,

I've been experiencing the exact same problem as you.

In my case it apppears to be related to the shield the Arduino is connected to. If I remove the Arduino from the shield, the bootloader performs exactly as you'd expect. Plug it back in and I can see my code stopping and the bootloader flashing the PortB.7 LED, followed by periodic flashes of the RxD led, but no response.

I've checked the schematic of the Arduino, and the only pins connected to the USB/serial convertor are TxD0, RxD0 and Reset. Since none of those is connected to anything on my shield, I can only assume that something in the bootloader is monitoring one of the other I/O pins, looking for some status. At the moment I've no idea what it could be, but it's very annoying having to unplug the Arduino everytime I want to alter the code. There's also a limit to the no. of times the board and shield will withstand this sort of abuse.

If I find out anything else, I'll post it here.

David

OK I think I can offer some insight into what's likely to be going on.

I had a look through the bootloader source supplied with Arduino 1.0 I suspect this isn't as supplied with the Mega2560 board, but close enough for a good guess.....

In the source, there are various conditional compiles for different processors. If the processor was set to Mega128, then the boot loader reads ports F6 and F7 and uses the results to decide which UART to listen to.....

You can tell which one it selects by counting the flashes on the PortB7 led.

When I have my Arduino MEGA2560 connected to the USB port on its own, then I see 2 flashes each time the IDE starts uploading. If I plug the Arduino into my shield, then I only see a single flash. This is odd, since with the shield in place, powering up produces 2 flashes and so does opening the serial port (using Hyperterm on Windows XP).

Here are two more symptoms since I posted the first msg of this thread.

  1. First -
    Checked verbose output during upload in File->Preferences:
  1. Held the shift key while selecting
    after selecting File->Upload from menu and the following output was generated -

Binary sketch size: 1602 bytes (of a 258048 byte maximum)
G:\Dev\Arduino\Ver1_Software\arduino-1.0\hardware/tools/avr/bin/avrdude -CG:\Dev\Arduino\Ver1_Software\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\.\COM3 -b115200 -D -Uflash:w:D:\DOCUME~1\larryh\LOCALS~1\Temp\build4790036421831321667.tmp\Blink.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 "G:\Dev\Arduino\Ver1_Software\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

Using Port : \.\COM3
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
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]
/* unplugged USB cable here */
avrdude: ser_send(): write error: sorry no info avail

Each "avrdude: Send: . ..." line was output to the IDE status window when the Red "RX" LED contiues to flash every 5 seconds.

  1. Here is second symptom:

Using the Loop-Back Test Instructions at
http://arduino.cc/forum/index.php/topic,73748.0.html
and Tools->Serial Monitor of IDE, the first entry in text box is echoed back except for the last character of line. None of subsequent lines are echoed at all when send button of Serial Monitor window is clicked.

Except for the jumper connections used for the Loop-Back Test, nothing (except USB cable) is connected to board during other test runs.

Should the TX LED flash during the Upload operation?

Does the "CPU used" need to be specified anywhere in program source code?

Larry

Larry,

at this point your symptoms are clearly different from mine.

The loop back test you performed removes the 2560 and bootloader from the problem and you are testing just the usb to serial chip on the board. For this to fail as you are seeing suggests that you have a faulty board. The verbose log suggests the same thing - there is initially communication in both directions (commands sent and replies received) but after a couple of commands, the board stops responding.

The problem I'm seeing is different. With my shield attached, there is never any response from the board. This is strange, since I have no trouble getting into the monitor using HyperTerminal. Just open the connection at 115200baud and type !!! immediately and everything works as it should.

David

The solution to the problem of the first posting of this thread was found at
http://arduino.cc/playground/Main/UnoWin2k
(Programming An Uno Under Windows 2000)
Even though this article states it is still under construction, the procedure described fixed the problems described in this thread.
The usbser.sys file used from a Window XP PC has Service Pack 3 installed and file size is 28672 bytes.

Blink program and Loop-Back Test Instructions at
http://arduino.cc/forum/index.php/topic,73748.0.html
work fine.

Larry

Other cause of the timeouts uploading to Mega are the "!!!" inside one of the strings of the code

This is not a joke:
http://code.google.com/p/arduino/issues/detail?id=797

I had the same problem and symptoms. But, embarrassingly, my timeouts were caused by having the wrong wiring plugged into the PWM sockets when they should've been in the analog sockets. It was a late night...