Eclipse, Arduino 2560 and AVRDude – timeout

I’m in the process of restructuring the polargraph firmware, and the first thing I’m doing is moving most of the functions out to a library that can be used by all polargraph firmwares (uno, mega etc).  So that’s easy, you’d think.  I’m a fairly naive c++ programmer so don’t be surprised that I’m trying to get it working in eclipse so as to have a decent overview of things, function names and whathaveyou.  I find it useful when making cross-cutting changes.

So I came across Eclipse/Arduino tutorial page,  which is really good, and got it working on a Duemilanove I have – beautiful!  That said, I can quite see why the Arduino IDE is popular even though it lacks functions.  Eclipse is the archetypal jack of all trades and master of none, and requires a load of configuration to even get started on things.

But the MEGA? Not so much.  I got stuck so went to see how the Arduino IDE does it, and pulled out the AVRDude command it was using (turn verbose output on for the uploading in preferences):

c:\Dev\arduino-1.0\hardware\tools\avr\bin>avrdude -CC:\Dev\arduino-1.0\hardware/
tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM55 -b115
200 -D -Uflash:w:C:\Users\sandy\AppData\Local\Temp\build4894098567197191708.tmp\
Blink.cpp.hex:i

That’s what it emits, but when I put that same text in at the command line, I am faced with

avrdude: stk500v2_ReceiveMessage(): timeout

Which is the same problem I was bumping into in Eclipse.  Well.

The fix

Turns out using the arduino or stk500v2 programmer, the board doesn’t get reset before programming.  I could get around this just by pressing the reset button and then uploading that same instant, mostly, but it’s not very clever.  Then I came across a better solution at this page discussing the error in avrdude 5.10 (I’m using 5.11 that comes with the Arduino IDE so I guess it’s still an issue), and that solution is just to use the Wiring programmer instead of the Arduino programmer that works fine on the Duemilanove, or the stk500v2 programmer that the Arduino IDE uses.

That worked fine.

4 thoughts on “Eclipse, Arduino 2560 and AVRDude – timeout

  1. Word of warning about avrdude 5.11: don’t use it to dump EEPROM as it has a known bug and gives you back every other set of 8 bytes. avrdude 5.10 works fine for dumping EEPROM. Other than that, 5.11 works great. (P.S. I’ve had that same reset issue you were dealing with. Also, there’s fun if you ever need to reload the boot loader but don’t know that you need to use the avrdude switch to perform a chip erase. Lost an hour of my life on that one as well once.)

    • Yeesh, Dan I can really see why hiding the toolchain is important in Arduino’s success – such a learning curve on it. I eventually went back to using notepad++ for writing the library and compiling through the arduino IDE… A cop-out, I know, but I’m picking battles, and I at least know a bit more now.

  2. Have you tried the eclipse plugin you can find at eclipse.baeyens.it?
    It works great with the mega as it resets the mega before upload since version (I don’t know any more 😉 )
    Besides it also has a serial monitor 😀
    Jantje

Leave a Reply