Arduino: Restore Arduino UNO bootloader using avr dragon
If you "play" a lot with Arduino UNO then you may end up with locked up device or broken boot loader. There is way out of this problem but you will need additional device. I am using avr dragon for ISP programming and following commands can be used to restore Arduino UNO boot loader.
Arduino UNO use optiboot and recent version can be found at github. Download
optiboot_atmega328.hex before continuing.
Erase flash (to start with clean device).
avrdude -p m328p -c dragon_isp -P usb -e
Configure fuse and lock bits (to be sure that boot loader will work as expected).
avrdude -p m328p -c dragon_isp -P usb -u -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x05:m -U lock:w:0x3f:m
Burn boot loader.
avrdude -p m328p -c dragon_isp -P usb -e -U flash:w:optiboot_atmega328.hex -U lock:w:0x3f:m
Note 1: this will work also with other Atmel devices. Just adapt configuration and retrieve correct file from optiboot repository at github.
Note 2: LED will blink periodically on Arduino UNO once all steps are done. It is because boot loader will try to start application. At this point app code is missing so Atmel mCPU start boot loader again.