Timeout() issue with WinAvr/Avrdude on 2560 .HEX upload

Hi,

I am experiencing a timeout issue when I try to upload a .hex file compiled in WinAvr using the avrdude utility. I experience the same issue when I run avrdude from the command line. I hope this is enough information to get some feedback on this issue, please let me know if more data is required:

O/S: Windows XP SP3
WinAvr: v2.0.8.718-basie
Arduino IDE: 1.0
avrdude: v5.11
Processor: ATmega2560
Com Ports: I have tried COM4 and COM2 (They both show up in the Device Manager properly as:
"Arduino Mega 2560 R3 (COM2)" and "COM4" respectively.

I have tried to hold the Reset Button down prior to uploading my .hex file at a variety of time points. This is as suggested in several of the threads on the forum.

The exact error I am receiving is: "avrdude: stk500v2_ReceiveMessage(): timeout"

I am able to upload sketches with the Arduino IDE.

I wasn't sure if this would help debug my issue but the following is an example session and its returned error code:

avrdude -F -v -pm2560 -cstk500v2 -P\.\COM4 -b19200 -D -Uflash:w:"C:\Documents and Settings\Mozart\My Documents\Arduino Test Project\MEGA_GPIO_EXAMPLE1\MEGA_GPIO_EXAMPLE1\Debug\MEGA_GPIO_EXAMPLE1.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\arduino-1.0\hardware\tool
s\avr\bin\avrdude.conf"

Using Port : \.\COM4
Using Programmer : stk500v2
Overriding Baud Rate : 19200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
etc.....

Thank you for any assistance you can provide. Please let me know if more information is required.
-Ken Q.

What if you use a baud rate the bootloader is expecting, like 115200?

I will try that but I was wondering if I have to set the com port to 115200 as well. I believe the default com port in windows, when it finds a hardware "COM device", is 9600.

Thanks
-Ken Q.

Ok, I tried using the baud rate the boot loader expects of 115200 and received the same error message:

avrdude: stk500v2_ReceiveMessage(): timeout

Another thread indicated that:

"The serial monitor ties up the com port just as an upload would, make sure no serial monitors are open, go to com4's properties and click advanced, set a port spec above com10. Select the applicable port in the ports menu in the arduino ide tools....Serial Ports"

So I set the COM port to COM15 and received the same error message. Any recommendations would be welcome...

Thanks,
-Ken Q.

Compile a sketch in the ide and look to see what parameters avrdude is using when the ide send the hex file. there has to be some switch that you have left out or modified.

I have the verbose compile settings turned on and can see what is happening when the compiler is executed within the IDE, however, there are no messages when the program is uploaded to the board (i.e. using avrdude). In fact the last message that I can see prior to the program being uploaded within the IDE is:

Binary sketch size: 1602 bytes (of a 258048 byte maximum)

What do I need to set and where do I do the settings to get a verbose IDE/avrdude upload?

Thanks,
-Ken Q.

Clearly, debugging messages aren't turned on if that is the last message you see.

Pre-1.0 hold down "shift" when you click upload or verify. Post, you can enable debugging in the preferences.

Agreed, debug was not turned on for the upload, however, the verbose settings were turned on for compilation. The last line is accurate for a clean compile and that is what I posted. However, I did not have verbose settings turned on for the upload and I do now (I didn't see that option when I was last in preferences). Anyway, I did go into preferences and set that switch so I could get a verbose listing on upload. This time during upload there is so much information scrolling by that I am unable to catch the switches used by the IDE. Evidently a successful upload fills the multi-line edit buffer at the bottom of the IDE.

Is there a way to pause the scrolling as the program is being uploaded so I can see the switches used. I am using Arduino 1.0 if that helps.

Thanks,
-Ken Q.

Disconnect your board once the upload begins, so that the upload fails (and doesn't fill the window's buffer.)

James - Thanks I hadn't thought to unplug while doing the upload and that worked with copying what the IDE is using for its makefile switches. Here is a copy of the IDE makefile and keep in mind that this works within the IDE just fine:

C:\Arduino\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Arduino\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\.\COM4 -b115200 -D -Uflash:w:C:\DOCUME~1\Mozart\LOCALS~1\Temp\build5991853816765248887.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 "C:\Arduino\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

Using Port : \.\COM4
Using Programmer : stk500v2
Overriding Baud Rate : 115200

=======>

Here is a copy of my CMD session:

C:\Arduino\arduino-1.0\hardware\tools\avr\bin>avrdude -CC:\Arduino\arduino-1.0\h
ardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\.\COM
4 -b115200 -D -Uflash:w:C:\DOCUME~1\Mozart\LOCALS~1\Temp\build599185381676524888
7.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 "C:\Arduino\arduino-1.0\hardware/tool
s/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:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]

=====>

I just copied what was captured and pasted it. The results are still the same in terms of the Timeout error. Any other suggestion?

Thanks,
-Ken Q.

Have you closed the IDE when you do this?

Also can you put code tags around that stuff? It's hard to read like that.

Yes I did close the IDE before the upload but still same results. Nick, sorry that was hard to read, I would be glad to put code tags but I am not sure what you mean.

Thanks,
-Ken Q.

Edit your earlier posts (hit the Modify button), select the relevant stuff, then hit the "#" button above the input box.

Same errors and time outs here also. Worked on it for a while. I think it may be caused by Java. Too tired to go into detail now but I saw errors relating to Java. Has Java done an update lately???