Hi All,
I started playing with an atmega32u4 breakout (Sparkfun) yesterday, and noticed that after a power cycle it didn’t run my application (a simple blinky type app). So I did some googling and quickly came to the conclusion that BOOTRST was programmed, hfuse 0xd8, so set about trying to set hfuse to 0xd9, everytime I did it would fail.
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xd9 != 0xd8
avrdude: verification error; content mismatch
So after some more googling I discovered the lockbit, it was set to 0x94, so after some googling and reading the datasheet for the atmega32u4 I discovered I could reset the lockbit by erasing the chip, so I did this:
avrdude -e -v -c avr109 -p atmega32u4 -P /dev/ttyACM1
Strangely after I’d done this (successfully according to avrdude) my app started running. The lockbit now tells me its set to 0xC0:
>>> dump lock
0000 c0 |. |
However if I try to write a new value into the lockbit I get this (I know this won’t work):
avrdude> write lock 0 0x97
>>> write lock 0 0x97
avrdude (write): error writing 0x97 at 0x00000 cell=0x94
Interestingly the lockbit claims its 0x94, and it will allow me to write 0x94 into it.
The current status of my board is that it boots into the bootloader, I then need to perform some function with avrdude to get it run my blinky code, but I can’t write any new code to it.
Am I missing something here? How can I force the chip to actually erase resetting the lockbit.
avrdude version: 5.11.1
Thanks,
Peter