AVR Fuses Explained

AtmelStudio Fuses

To the left is a picture of Atmel Studio ‘Device Programmer’. In this particular menu you can change the fuse settings for the Atmega328P. At first glance I admit I was a little overwhelmed as I’m sure most people are when first looking at all these abbreviations. But fear not, my goal is to make this as quick and simple as possible, because not having an understanding of what each fuse does could cause a whole lot of headache in the future. And I don’t recommend copying the fuse settings from the Arduino, unless you are programming an Arduino. Your project could be a completely different setup than the Arduino, especially if you’re programming without a bootloader. Alright now lets get down to business.\

Table of Contents:

  1. BODLEVEL
  2. RSTDISBL
  3. DWEN
  4. SPIEN
  5. WDTON
  6. EESAVE
  7. BOOTSZ
  8. BOOTRST
  9. CKDIV8
  10. CKOUT
  11. SUT_CKSEL

BODLEVEL (Brown-Out Detection):

  • What is it – Brown-out detection is used to determine when the voltage has dropped below a certain level. When dropping below the designated voltage the device will turn off until the voltage returns to its required state.
  • Why have it – Accuracy. If your microcontroller is running at 16Mhz then you will need at least 4V to run it at that frequency. Anything lower will create poor results. Example. Say you hook up a temperature sensor to your device and are running it off of a 16Mhz oscillator at 3V. You are likely to recieve the wrong temperature and some abnormal figures where you’re
  •  displaying it. Brown-out detection would turn off the device and reset once the power level returned to the right level.
  • Options for Atmega328P
    • DISABLED
    • 1V8
    • 2V7
    • 4V3
Frequency vs Voltage
Frequency to Voltage charge for ATmega328

 

 

 

 

 

RSTDISBL (Reset Disable):

  • What is it – This will turn the RESET pin into a normal I/O pin. I would discourage you from turning this on because it will prevent you from programming with ISP.
  • Why have it – I imagine this is more for commercial development to prevent people from resetting the device themselves and/or programming or pulling the hex file from the device. Basically security. If you’re just a hobbyist don’t enable it.
  • Options for ATmega328P – On/Off

DWEN (Debug Wire Enable):

  • What is it – It allows you to enable the debug wire (pin). With this active it will turn the RESET pin into the debug wire (dW). From my understanding you cannot debug the device through ISP and need to have this wire activated in order to do so.
  • Why have it – Simply put, debugging. I’m unfamiliar with debugging through this process, and if you’re just starting out, it’s likely your projects wont be complicated enough to warrant the use of this option so I would have it disabled.
  • Options for ATmega328P – On/Off

SPIEN (Serial Program Downloading):

  • What is it – This enables serial programming on your device. You’ll want this turned on if you plan to program using ISP or UART as both are methods of serial programming.
  • Why have it – If you want to do on-board programming with the serial protocol. One reason to turn this off is for security. You want to prevent someone from accessing your microcontroller through serial communication, then turn this off.
  • Options for ATmega328P – On/Off

WDTON (Watchdog Timer Always On):

  • What is it – This ones coming straight from the datasheet. Will force the Watchdog Timer to System Reset mode. With the fuse programmed the System Reset mode bit (WDE) and Interrupt mode bit (WDIE) are locked to 1 and 0 respectively.
  • Why have it – (Keep this turned off) This feature is made for  security and it is even stated as such in the datasheet. If you need more info on it, I would check the datasheet.
  • Options for ATmega328P – On/Off

EESAVE (EEPROM Save Through Chip Erase):

  • What is it – This option will keep what ever you have programmed in the EEPROM safe when you want to erase the whole chip.
  • Why have it – This is especially good if you have a boot loader installed in the EEPROM. Have this enabled will keep your information safe in case the chip is accidentally erased while programming. I’m sure there are some better reasons too, but at the moment I personally program only to the flash memory so I leave this option turned off.
  • Options for ATmega328P – On/Off

BOOTSZ (Boot Size):

  • What is it – This designates an allotted amount of memory space for the bootloader.
  • Why have it – I’m sure it has something to do with the efficiency of the device.
  • Options for ATmega328P
    • 256W_3F00 – 256 words (512 bytes) starting at flash section 0x3F00
    • 512W_3E00 – 512 words (1024 bytes) starting at flash section 0x3E00
    • 1024W_3C00 -1024 words (2048 bytes) starting at flash section 0x3C00
    • 2048W_3800 – 2048 words (4096 bytes) starting at flash section 0x3800

BOOTRST (Boot Reset vector):

  • What is it – This tells the microcontroller to run the bootloader after the device is reset.
  • Why have it – This is what starts your bootloader. If this is not activated, your bootloader will never run. So if you have a bootloader make sure this is active.
  • Options for ATmega328P – On/Off

CKDIV8 (Divide Clock Internally by 8):

  • What is it – It divides the internal 8MHz clock by 8, producing a clock speed of 1MHz.
  • Why have it – It states in the datasheet that the microcontroller is shipped with this active, to add some ease when initially programming it. It also allows you to drop the device below 8MHz if the application requires it. If you are using an external clock then this should not be active.
  • Options for ATmega328P – On/Off

CKOUT (Clock output on PORTB0):

  • What is it – Configures the CLKO pin to output the system clock and overrides the I/O functions. System clock is what ever frequency the microcontroller is running. From either internal or external oscillators.
  • Why have it – You would use this option to run another chip at the same frequency or debug the clock frequency.
  • Options for  ATmega328P – On/Off

SUT_CKSEL (Select Clock Source):

  • What is it – It allows you to choose from a rather large selection of clocking options. Ranging from internal to external, 128KHz – 8Mhz.
  • Why have it – You are able to configure the microcontroller to run a the speed your application requires.
  • Options for ATmega328P – I’m going to do something different here because there are so many options. I while decipher the acronyms you’ll see in this list and hopefully that will give you an idea of how it works. All acronyms are based on AtmelStudio other options may vary, but the general idea is the same.
    • EXTXOSC – External Clock – Goes back to the CKOUT example
    • INTRCOSC – Internal RC Oscillator – Internal Clock
    • EXTLOFXTAL – External Low Frequency Crystal – Good for 32kHz crystals
    • EXTFSXTAL – External Full Swing Crystal – Good for passing clock to other devices, but requires more power
    • EXTXOSC – External Low Power Crystal – If you’re only providing a clock to one microcontroller this is the option for you.
    • Next we’ll use an example and to give you the rest of values. EXTXOSC_8MHZ_XX_16KCK_14CK_65MS. You already know that the EXTXOSC is the low power crystal. 8MHZ_XX is 8MHz and above. The XX will show a value with frequencies below 8MHz. 16KCK is 16000 clock cycle start up time, 14CK is wait 14 cycles and 65MS is wait an additional 65 MS before start up. Generally with crystal oscillators a longer start time will grant more stability, so keep that in mind when choosing a clock setting.