Go Down

Topic: Arduino Mega 2560 and Eclipse (Read 2259 times) previous topic - next topic

Francisco Delmar Kurpiel

I bought an Arduino Mega 2560 and am trying to use eclipse to build and upload my code. I already used eclipse on my 168 with no problems, witch was configured using the tutorial on the Arduino page.

To make eclipse work with the Meta2560 I've changed "Target Hardware" to "ATmega2560". The programmer configuration is more dificult. According to boards.txt the programmer should be stk500v2 and the baud rate 115200bps. In this way I get:

Code: [Select]
C:\WinAVR-20100110\bin\avrdude -pm2560 -cstk500v2 -Pcom29 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout


I've already tried a lot of combinations of cstk500v2, cstk500v1, cstk500, arduino and cstk200 with baud rates of 19200, 57600 and 115200 and got timeouts or sync errors. For example:

Code: [Select]
C:\WinAVR-20100110\bin\avrdude -pm2560 -cstk500v1 -Pcom29 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

make: *** [avrdudedummy] Error 1


So, the question is simply: how can I use avrdude to upload my firmware into my Arduino Mega 2560?

ps: It works fine with the Arduino IDE.

Coding Badly


I can't remember if it's necessary but all my examples use it...

C:\WinAVR-20100110\bin\avrdude -pm2560 -cstk500v2 -P[glow]\\.\[/glow]com29 -b115200 -V -D -Uflash:w:arduinotest.hex:a

Andy Brown

#2
Nov 24, 2010, 11:03 pm Last Edit: Nov 24, 2010, 11:04 pm by foxbat Reason: 1
The programmer should work as Arduino. This is what I have for the 328 and 1280. I don't see why the 2560 should be any different:

Home of the Nokia QVGA TFT LCD hacks: http://andybrown.me.uk

Francisco Delmar Kurpiel

No effect.

Applying the changes by Coding Badly and Andy Brown (thank you)

Code: [Select]
C:\WinAVR-20100110\bin\avrdude -pm2560 -carduino -P//./COM29 -b57600 -V -D -Uflash:w:arduinotest.hex:a
avrdude: stk500_getsync(): not in sync: resp=0xfc

avrdude done.  Thank you.

make: *** [avrdudedummy] Error 1


Changing to 115200 bps (that seams to be the baud rate used by Arduino IDE on this board):

Code: [Select]
C:\WinAVR-20100110\bin\avrdude -pm2560 -carduino -P//./COM29 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude: stk500_getsync(): not in sync: resp=0xe0

avrdude done.  Thank you.

make: *** [avrdudedummy] Error 1


Unfortunately the "//./" before the port name don't seams to have effect.

I've tried also *all* combinations of arduino, stk500, stk500v1 and stk500v2 with 57600 bps and 115200 bps, without success. Any glue?

Coding Badly


You might want to try with the other slashes.

Francisco Delmar Kurpiel

#5
Dec 15, 2010, 07:04 pm Last Edit: Dec 15, 2010, 07:33 pm by franciscokurpiel Reason: 1
I'm very sorry for taking so long time to answer. I had to finish the project using the Arduino IDE. :\

Returning to the problem, the change from "//./" to "\\.\" makes no diference on the errors. But I've discovered by accident a few minutes ago that if I fire the following commands in sequence the first fail and the second succeeds:

Code: [Select]
avrdude.exe -pm2560 -carduino -P\\.\COM20 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude.exe -pm2560 -cstk500v2 -P\\.\COM20 -b115200 -V -D -Uflash:w:arduinotest.hex:a


The execution goes like:

Code: [Select]
$ avrdude.exe -pm2560 -carduino -P\\.\COM20 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude.exe: stk500_getsync(): not in sync: resp=0xe0

avrdude.exe done.  Thank you.


$ avrdude.exe -pm2560 -cstk500v2 -P\\.\COM20 -b115200 -V -D -Uflash:w:arduinotest.hex:a

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.07s

avrdude.exe: Device signature = 0x1e9801
avrdude.exe: reading input file "arduinotest.hex"
avrdude.exe: input file arduinotest.hex auto detected as Intel Hex
avrdude.exe: writing flash (18254 bytes):

Writing | ################################################## | 100% 4.02s

avrdude.exe: 18254 bytes of flash written

avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.


They must be fired in sequence without waiting between them, of the second command will fail like:

Code: [Select]
$ avrdude.exe -pm2560 -cstk500v2 -P\\.\COM20 -b115200 -V -D -Uflash:w:arduinotest.hex:a
avrdude.exe: stk500_2_ReceiveMessage(): timeout
avrdude.exe: stk500_2_ReceiveMessage(): timeout


and repeat the timeout line endlessly.

I'll try to add the first line on the build chain on eclipse to see if it works, but I'm quite confident it will. Some idea about how to solve the problem with a more... say 'elegant' approach?

Go Up