Go Down

Topic: atmega324p bootloader can't write flash [SOLVED] (Read 1 time) previous topic - next topic


Oct 10, 2012, 09:18 pm Last Edit: Oct 11, 2012, 09:28 pm by frpr666 Reason: 1
1/ I have device atmega324p, I downloaded the bootloader from site: https://github.com/magnuskarlsson/SDLogger/wiki/Arduino-howto
2/ I modified a little bit the "Makefile" and "ATmegaBOOT.c" for chip atmega324p, speed 19200, cpu_speed 16MHz
3/ I burned it by avrdragon
4/ I joined RS232-TTL (max232) cabel to PC and to the chip
5/ I made a successful test:
Code: [Select]
$ avrdude -c avrisp -p m324p -P com1 -b 19200 -F -U flash:r:readout:i
6/ but writing doesn't work
Code: [Select]
$ avrdude -c avrisp -p m324p -P com1 -b 19200 -F -U flash:w:main_blinking.hex:i

What is wrong?
Please any advice how to upload atmega324p chip?
Or does someone provide Arduino IDE files for chip atmega324p?

Tom Carpenter

Oct 10, 2012, 11:35 pm Last Edit: Oct 10, 2012, 11:48 pm by Tom Carpenter Reason: 1
You have specified to avrdude to program the chip using ISP (note the avrisp), and yet you are trying to use a bootloader. The two are very different.

Off the top of my head I can't remeber what ATmegaBOOT uses in relation to avrdude. I think that optiboot is 'arduino' (instead of avrisp), or is it 'stk500v1'. Would have to check.

Try this:
avrdude -c arduino -p m324p -P com1 -b 19200 -D -U flash:w:main_blinking.hex:i


Thank you. Today I have found the bug. I forgot change line 119 in ATmegaBOOT.c for chip m324p. Now it works both reading & writing.
Bootloader code is here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=1000323#1000323
Code: [Select]

$ avrdude -c avrisp -p m324p -P com5 -b 19200 -F -D -U flash:r:readout.hex:i
$ echo 'this one reads the chip'

$ avrdude -c avrisp -p m324p -P com5 -b 19200 -F -D -U flash:w:main.hex:i
$ echo 'this one writes the chip'

$ echo '-c arduino instead of -c avrisp works too'

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131