Skip to content

Burning the Fuses

jbaumann edited this page Apr 13, 2020 · 14 revisions

To burn the fuses you use the program avrdude that is part of the ArduinoIDE. Sadly, it is a bit hidden and its location changes from time to time. The best way to identify the program path and the path to the configuration file for it is to simply copy & paste it from the output window of the ArduinoIDE after you have flashed the firmware to the ATTiny.

The avrdude command, general part

On my Macbook, with the ArduinoIDE 1.8.12, avrdude together can be found under Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude

and the configuration file (given following the parameter -C) under

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf

We are using the following general parameters

-v -pattiny85 -cusbasp -Pusb -B3

-v for verbose, -pattiny85 for the processor, -cusbasp for the programmer, -Pusb for the interface used and -B3 for the speed with which the communication with the chip takes place.

Now avrdude knows how to communicate with our chip and which chip to expect.

Calculating the fuse values

To calculate the exact values for the different fuses (low fuse, high fuse and extended fuse) we could study the documentation and calculate the bits that way (I originally did that). But we can also find a number of fuse calculators online, and the one on which I’ve come to rely on in the meantime is the Engbedded Fusecalculator.

Using this fuse calculator we start with the default values for the ATTiny85, turn off CKDIV8 (we need 8MHz, not the 1 MHz default factory setting), and choose 2,7V for the brownout-detection setting (BODLEVEL 101).

This leads to the fuse values 0xE2, 0xDD and 0xFF for low, high and extended fuse shown in the lower part of the web page.

The avrdude command, programming the fuses

The best part with this web page is that the parameters for avrdude are already shown and we only have to copy them: -U lfuse:w:0xe2:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m

We simply add these after the general part of the avrdude command and can now program the fuses on the command line with the following command:

Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -pattiny85 -cusbasp -Pusb -B3 -U lfuse:w:0xe2:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m

Remember, you probably have to change the paths to executable and configuration file.

In principle writing the fuses should not interfere with the firmware you have already flashed, but time and again I had some problems with it and so I simply always flash the firmware again whenever I have changed the fuses.

Clone this wiki locally