Pages: [1]   Go Down
Author Topic: Arduino Mega 2560 and Eclipse  (Read 1679 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12285
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

Essex, UK
Offline Offline
Full Member
***
Karma: 4
Posts: 150
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

« Last Edit: November 24, 2010, 05:04:22 pm by foxbat » Logged

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No effect.

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

Code:
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:
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?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12285
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


You might want to try with the other slashes.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
$ 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:
$ 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?
« Last Edit: December 15, 2010, 01:33:31 pm by franciscokurpiel » Logged

Pages: [1]   Go Up
Jump to: