Arduino Bootloader
Arduino among others has a really nice feature… The bootloader. Once you burn it on the chip you can upload your code without the need of an external programmer.
I have started using it for my AVR projects but i came across on some issues so i compiled a COMPLETE list of what you need to do it, in order not to search again for the obvious…
Programmer used AVR910 or compatible with avrdude. On the avrdude commands i have omitted the port and the programmer type.
ATMEGA8
The default fuses of ATMega8 are (pdf and locally tested):
High Fuse: 0xd9
Low Fuse: 0xe1
Lock: 0x3f
Programming the bootloader. Chip erase (-e maybe needed in some cases)
Unlock the bootloader (TEST: try with -e)
avrdude -p atmega8 -b 115200 -U lock:w:0xff:m
(fails with avrdude: verification error, first mismatch at byte 0×0000 0xff != 0x3f)
Program the fuses
avrdude -p atmega8 -b 115200 -U hfuse:w:0xca:m -U lfuse:w:0xdf:m
Burn the bootloader (TEST: try with -D disable auto erase)
avrdude -p atmega8 -b 115200 -U flash:w:ATmegaBOOT.hex
Lock the bootloader
avrdude -p atmega8 -b 115200 -U lock:w:0xcf:m
(fails with avrdude: verification error, first mismatch at byte 0×0000 0xcf != 0x0f)
But it works….
ATMEGA168
The default fuses of ATMega168 are (pdf and locally tested):
High Fuse: 0xd9
Low Fuse: 0xe1
Lock: 0x3f
Programming the bootloader. Chip erase (-e maybe needed in some cases)
Unlock the bootloader
avrdude -p atmega168 -b 115200 -U lock:w:0x3f:m
Program the fuses
avrdude -p atmega168 -b 115200 -U hfuse:w:0xdd:m -U lfuse:w:0xff:m -U efuse:w:0×00:m
Burn the bootloader
avrdude -p atmega168 -b 115200 -U flash:w:ATmegaBOOT_168_ng.hex
Lock the bootloader
avrdude -p atmega168 -b 115200 -U lock:w:0x0f:m
And now the good part:
Once you burn the bootloader to a chip you can use this excellent program to upload any hex file to your ATmega with Arduino uploader
References
the only thing i get is ”initialization failed, rc=-1
please help
Grtz, Geert
What is the exact command that is failing ? Linux or Windows ?
@billy
windows.
and the command is:
1. avrdude -p atmega8 -c usbtiny -b 115200 -U lock:w:0xff:m
2. avrdude -p atmega8 -c usbtiny -b 115200 -U hfuse:w:0xca:m -U lfuse:w:0xdf:m
3. avrdude -p atmega8 -c usbtiny -b 115200 -U flash:w:ATmegaBOOT.hex
4. avrdude -p atmega8 -c usbtiny -b 115200 -U lock:w:0xcf:m
Grtz. Geert
i made a test board for this
connections:
icsp atmega8 -16pu
1 –> MISO
2 –> none
3 –> SCK
4 –> MOSI
5 –> RESET
6 –> none
and then for the atmega8 -16pu:
pin 7 VCC and pin 20 AVCC to 4,5 v
pin 8 GND and pin 22 GND to GND
Wiring looks correct. But you are missing 6->GND
Do you want me to send you a programmed atmega8 ?
I try to upload Arduino to ATMega328 with AVR910 programmer, but not success. Anyone can suggest me what software that support AVR910 and ATMega328?
Hey,
Brilliant tutorial… Very easy to follow and straight forward..Thank you so much..i spent days on this..