AVR Fuse Bits


Fuse bit: 

The fuse bits are very confusing for the beginners. Before configuring the fuse bits for your device, you must know how to configure them. This tutorial will explore the fuse bits and also give a clear understanding of what fuses you need to set for your device. Fuses are an extremely important part programming a chip, but are rarely explained thoroughly. You only need to set them once as the fuse bit settings are not affected by the chip erase operation, but if you don’t do it right, it’s a disaster!

Where do fuse bits reside?

Fuse bits live in a different memory space than the program memory. There are three main memory areas (Flash for program code, SRAM for run time variables and EEPROM) in ATmega series of microcontrollers and fuse bit form a fourth memory area. This means that the fuse bits are not affected by a program memory eraser. This has the advantage that once you program the correct fuse bits in your AVR, you can forget about them and no need to reprogram them each time you alter the program memory.

Why we need a fourth memory area?

There are few parameters in the chip which are used to configure before it can be used for external environment. These parameters are set with the use of Fuse Bits. In other words, the fuse bit determines the behavior of the chip, whether it has a boot loader, what is the speed and voltage it runs at, the Watchdog Timer conditions, memory protection modes, start up options, clock source and divider, programming options, etc.

The main advantage of fuse bits is that the microcontroller can be configured as per the requirement. There is no way to change the clock behavior through the program code. Fuse bits differ greatly between different AVR variants.

How to program fuse bits?

The details of how to program the fuse bits in your AVR depend on the particular programmer you are using. Consult the manual about the details. For instance, if you are using an STK600 with AVR Studio, the STK600 window has a tab labeled Fuses, where you set the different bits and where you can program, verify or read the fuse bits.

The unprogrammed state of a fuse bits is logic high, programming any fuse bit will change its level to logic low. Except fuse bits related to boot loader are not accessible from software, but, these can be accessed in programming mode using parallel /serial programming tool.

 

One should be very careful while writing the fuse bits of the device. Before setting any lock bit of the device one must program required fuse bits. In case of SPIEN bit you got to be very careful, as in case if you disabled this bit while programming using a SPI programmer, then the chip cannot be further programmed. But it can be again programmed by using parallel programmer. In STK600 one can reprogram as well as enable SPIEN in HVPP programming mode.

The AVR microcontroller (ATmega16) consists of sixteen fuse bits which are classified as low fuse and high fuse. These Fuse bits can be configured to select the microcontroller clock options or to control some in-built peripherals like JTAG, SPI etc.

high_fusebit.fw

 low_fusebit.fw

Fuse Description

 

RCEN: By programming this fuse, an internal RC Oscillator is used as the main Master Clock for the MCU. Some AVRs are shipped with this fuse preprogrammed, others not. Check the datasheet to determine the default state of this fuse.

SPIEN: This fuse bit controls the In-System Programming interface. If the fuse is programmed, SPI is allowed. If unprogrammed, the SPI interface is disabled.

RSTDISBL: By programming this fuse the RESET pin is turned into a general IO pin. On some devices the pin is tuned into an IO pin, and on others into an Output only pin. Please read the applicable datasheet carefully to find the details on a given device.

FSTRT: The Fast Start Fuse controls the startup time for the MCU. If you use a ceramic resonator, or a fast-start Oscillator/clock system, you can program this fuse. This will allow the MCU to start running code quicker.

BODEN: By programming this fuse, the internal Brown-out Protection Circuitry inside the AVR is enabled. This circuitry will monitor the voltage and put the AVR in reset state if brownouts occur.

BODLEVEL: If BOD is enabled, the BODLEVEL Fuse will change the Brown-out voltage and Start-up times. This is device dependent. See the applicable datasheet for details.

CKSEL n..0: The CKSEL Fuses decide the delay period and the clock system that are used. The available clocking modes and Start-up times are device dependent. See the applicable datasheet for details.

EESAVE: By programming this fuse, the content of the EEPROM is not erased during a normal Chip Erase cycle. To erase the EEPROM, you will first need to unprogrammed this fuse, then do a Chip Erase.

SUT n..0: The SUT Fuses decide the delay period from the External Reset is released (not active anymore) until the Internal Reset is released; the Start-up time. This period should be selected on the basis of what kind of system clock you are using. If you are using an external clock source, a short Start-up time should be sufficient, but if you are using a crystal that needs a long time to be stable, a longer Start-up time is required.

BOOTRST: The Boot Size Fuses select the size and start address of the Boot section. Boot section is only available in devices with SPM instruction.

BOOTSZ n..0: The Boot Size Fuses select the size and start address of the Boot section. Boot section is only available in devices with SPM instruction.

INTCAP: When this fuse is programmed, the need for external crystal decoupling capacitors is eliminated, thus reducing total system cost. See the datasheet for typical capacitor values.

AVR_Fusebit

Dear friends if you like this post, please like us on facebook.  Please subscribe with your mail id to get latest article in your inbox.

Related posts:

About author

This article was written by admin

Admin has over twenty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles. Working presently as Development Manager in India. A firm Believer in Knowledge grows when it shared.

Comments

Comments (3)
  1. jalaja says - Posted: July 12, 2013

    This tutorial is very usefull to me ………….thanks a lot…………..

  2. Shrikant says - Posted: January 7, 2015

    Thanks a lot

Leave your comment

Your email address will not be published. Required fields are marked *