The Atmel 8-bit microcontrollers have fuse registers that can easily be overwritten during bootloader installation. If this happens you won’t be able to program your AVR via a serial programmer anymore. This might result in avrdude giving you the following response:
initialization failed, rc=-1 Double check connections and try again, or use -F to override this check
The most severe bits are the bits RSTDISBL, DWEN and SPIEN. The latter one cannot be overwritten in SPI mode, so that one should be save. You’re completely spoilt however if the RSTDISBL bit is set to zero (remember: fuse bits in AVR are read out as ‘enabled’ when set to 0). In this case you’ll need to use the high voltage programming mode of the AVR which I’ll explain below. The low voltage programming mode (normal ISP mode) cannot be used anymore since the reset pin is then no longer an input pin and it needs to be set to low voltage externally to enable the SPI interface.
Another problem occurs when DWEN is set to zero. This disables SPI programming and enables the debug wire single-wire interface.
To make sure, whether you’ve programmed your fuse bits to funky values try:
avrdude -c PROGRAMMER -P PORT -p DEVICE -n -v
And put the fuse byte values into the fuse calculator at http://www.engbedded.com/fusecalc/.
To resolve these issues, you need to apply high voltage programming as described here: http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon_HVSP_Description.htm
Btw.: There’s also an arduino solution for this problem: http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/
Helpful guides for me were:
- https://www.mikrocontroller.net/articles/AVR_Fuses (for readers capable of reading German)