Arduino mega with AVR studio : how to upload ?

i got arduino mega and i am welling to use avr studio to program it. i make my hex file but can't figure out how to upload it to the arduino.

all my attempt to upload using avrdude failed with some sort of an error.

do i need a programmer hardware unit like stk600 ?

Can you upload to the Mega using the Arduino IDE?

docesam:
all my attempt to upload using avrdude failed with some sort of an error.

do i need a programmer hardware unit like stk600 ?

No, I upload sketches, through the Arduino IDE, all the time to my Mega. However "some sort of error" isn't very helpful. Can you copy and paste the error?

PaulS:
Can you upload to the Mega using the Arduino IDE?

yes

i do press control c to terminate the error message

Can you describe how you've wired it up to do that? You've told avrdude that you have a stk500 programmer. Do you?

no ,i am connecting the arduino mega via USB. however i saw some tutorial somewhere doing that telling the the arduino have got stk500 bootloader :slight_smile:

wrong ?

Actually I think the Mega uses the stk500v2 protocol (allows for larger sketches). If you add this line to your preferences.txt file:

upload.verbose=true

... then you can see what it generates. In my case, to upload the Blink sketch it was:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P/dev/tty.usbmodemfa1341 -b115200 -D -Uflash:w:/var/folders/1l/43x8v10s1v36trvjz3v92m900000gn/T/build4052404889588940414.tmp/Blink.cpp.hex:i

This was on a Mac. Simplifying the path names a bit it would be:

avrdude -Cavrdude.conf -v -v -patmega2560 -cstk500v2 -P/dev/tty.usbmodemfa1341 -b115200 -D -Uflash:w:Blink.cpp.hex:i

So breaking that down:

Command: avrdude

Configuration file: -C avrdude.conf

Verbose output: -v -v

Device: -p atmega2560

Protocol: -c stk500v2 

Port: -P /dev/tty.usbmodemfa1341   (in my case)

Baud rate:  -b 115200

Disable auto-erase of flash: -D

Upload and write file to flash:  -Uflash:w:Blink.cpp.hex:i

it turns out that i was using avrdude.exe at "C:\WinAVR-20100110" ,when i switched it to the one whic came with arduino IDE it worked !!


what is the difference between those 2 ?

thank you very much :slight_smile: