What is AVR Fuse Bits ??
For Beginners Fuse bits seems to be very confusing but they are not so confusing .Just like to make some pins of micro-controller as output we have to set some bits in a DDR register, in order to micro-controller to work properly we have to set some fuse bits.In other words fuse bits are master registers whose values directly affects functioning of micro-controller.
Once the fuse bits are set for a particular configuration, the controller can be used again and again (can be programmed again and again without changing fuse bits). Fuse bits are only changed when you want to change the initial configuration of the controller. The main advantage of fuse bits is that the micro-controller can be configured as per the requirement.
Before configuring the fuse bits for your device, one must have thorough knowledge of fuse bits, when exactly and how would you configure them and what all are the factors which may affect the working of the device.
It is important to note that the fuse bit settings are not affected by the chip erase operation. They are configured separately by using external programmer.
The AVR micro-controller consists of sixteen fuse bits which are classified as low fuse and high fuse. Both low and high fuse is of 8 bit each. These Fuse bits can be configured to select the micro-controller clock options or to control some in-built peripherals like JTAG, SPI,clock source etc.
Setting a fuse bit to zero is programmed and setting it to 1 means not programmed. Normally some important fuse bits are set before-hand by the manufacturer.New micro-controller have default value of fuse bytes which is equal to 0x99E1 in hexadecimal( high fuse =0x99 and low fuse =0xE1).
To understand the value of above hexadecimal you have to understand each bit of High and Low fuse.
- Low Fuse
2. High Fuse
Description of Low Fuse
- CKSEL[3-0](Clock Select )
These four fuse bits of Low Fuse is used to select different clock source to micro-controller .below table you can see different clock option according to the different value of CKSEL bits.
2. SUT[1-0](Start up Time)
This bit is used to set start up time of ATmega16. The combination of SUT [1:0] and CKSEL0 bits are used to select the start-up time of controller.
3. BODEN(Brown Out Detection Enable)
ATmega16 has a brown-out detection unit which continuously monitors Vcc level with fixed trigger level. This fuse bit is used to enable/disable the brown-out detection unit.
0-> means Enable BODEN
1-> means Disable BODEN
4. BODLEVEL(Brown Out Detection Level)
Sets the voltage level that will cause the brown out detector to trigger . The BOD will hold the processor in an idle state until the voltage level stabilizes above the selected threshold. The processor will then perform a normal reset, and activate the MCU status flag indicating that a brown out occurred.
This fuse bit is used to set trigger level for BOD unit. Only two Trigger Level can be set one os 2.7 volts and other is 4 volts. These two levels depends upon the value of BODLEVEL bit.
1-> means trigger level is 2.7 volts
0-> means trigger level is 4 volts
Description of High Fuse
- BOOTRST (Boot Loader Reset)
What is it – BootLoader is a small program which is written on a specific area of the flash memory. This program executes at the boot time of the controller. This tells the micro-controller to run the boot-loader after the device is reset.
Why have it – This is what starts your boot-loader. If this is not activated, your boot-loader will never run. So if you have a boot-loader make sure this is active.
0-> the device will jump on first address boot-loader block every time when reset.
1-> normal execution of program
2. BOOTSZ[1-0](Boot Size)
This designates an allotted amount of memory space for the boot-loader. This is used mostly in conjunction with BOOTRST to determine where the processor should jump after a reset.
00 – > 256 words (512 bytes) starting at flash section 0x3F00
01 – > 512 words (1024 bytes) starting at flash section 0x3E00
10 – > 1024 words (2048 bytes) starting at flash section 0x3C00
11 – > 2048 words (4096 bytes) starting at flash section 0x3800
3. EESAVE ( EEPROM Save Through Chip Erase)
This will keep what ever you have programmed in the EEPROM safe when you want to erase the whole chip.
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.
0-> EEPROM preserve its content during chip erase.
1-> EEPROM does not preserve its content during chip erase.
4. CKOPT(Clock Output)
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.
You would use this option to run another chip at the same frequency or debug the clock frequency.
5. SPIEN (Serial Program Downloading)
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.
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 micro-controller through serial communication, then turn this off.
6. JTAGEN (JTAG Enable)
There is an in-built JTAG unit in ATmega, which is pre-activated in virgin micro-controller. To disable or disable the JTAG,this bit is used.
0-> means Enable the JTAG.
1-> Disable the JTAG.
7. OCDEN (On-Chip Debugging Enable)
The on-chip debugging is used to run the program step-by-step on hardware to study the internal signal which provides the information about state of the processor. This bit is used to enable/disable the on-chip debugging.
0-> on-chip debugging is enabled.
1->on-chip debugging is disabled.