Understanding AVR Fuse Bits

What are Fuse Bits in AVR?

Fuse bits configure critical low-level behaviors in AVR microcontrollers, such as clock source, brown-out detection, and bootloader settings.

Important: In AVR fuse settings:

  • 0 = Programmed
  • 1 = Unprogrammed

HFUSE Breakdown

HFUSE controls advanced settings in the AVR:

  • RSTDISBL (Bit 7): Disable reset pin if programmed (0). Keep as 1.
  • WDTON (Bit 6): Watchdog timer always on if 0.
  • SPIEN (Bit 5): Enable SPI programming if 0 (should remain 0 for ISP).
  • CKOPT (Bit 4): Clock option, typically 1 for crystal oscillator.
  • EESAVE (Bit 3): Preserve EEPROM on chip erase if 0.
  • BOOTSZ1:0 (Bits 2:1): Bootloader size configuration.
  • BOOTRST (Bit 0): Start at bootloader if 0.

Typical HFUSE for Atmega8:

HFUSE = 0xDF (11011111)

Writing HFUSE using AVRDUDE:

avrdude -p m8 -c usbasp -u -U hfuse:w:0xDF:m

LFUSE Breakdown

LFUSE typically configures clock source and startup times:

  • BODLEVEL (Bit 7): Brown-out voltage level.
  • BODEN (Bit 6): Enable BOD if 0.
  • SUT1:0 (Bits 5:4): Startup time configuration.
  • CKSEL3:0 (Bits 3:0): Clock source selection.

Typical LFUSE for Atmega8 with a 16MHz crystal:

LFUSE = 0xEF (11101111)

Writing LFUSE using AVRDUDE:

avrdude -p m8 -c usbasp -u -U lfuse:w:0xEF:m

Setting HFUSE and LFUSE Together

avrdude -p m8 -c usbasp -u -U hfuse:w:0xDF:m -U lfuse:w:0xEF:m

Key Takeaways

  • Fuse bits define how your microcontroller behaves on a low level.
  • Incorrect fuse settings can disable SPI or the reset pin, requiring a high-voltage programmer to recover.
  • Always refer to the Atmega8 datasheet when setting fuse bits.

Understanding and configuring fuse bits will help you develop more reliable embedded systems while utilizing your AVR microcontroller’s full potential.

Happy Tinkering!




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • What if we could stop heart failure—before it starts?
  • How not to die Young? Lessons from Cardiovascular Engineering
  • Using AVRDUDE to Program Your AVR Microcontrollers
  • Understanding Average Power, RMS Power, and AC Power
  • Introduction to Microcontrollers - The Brains Behind Everyday Electronics