8 Jul 2012

FuSe Bits and their functionality

Lets discuss about the Fuse bits which are perticularly important in atmega or avr microcontrollers .

Ya i will give some example to understand clearly i know that most of us know bike or car to ride right so lets think you have a bike and you need to ride it that has gares ok so you sit on bike and start it after that in order to move you need to step into bike/car and give your first gare to move the vehicle right in the same there are some conditions to be met in order to run the avr microcontroller . Even though you write program into microcontroller you need to gare it with fuse bits . We should give the clear gares how to work . ok

Now lets come to the atmega8 here you have fuses bits which are
  1. High fuse bits  (8 bits)
  2. Low fuse bits (8 bits)
and there are some other bits named  "EXTENDED FUSE BITS " which are not present in this microcontroller for some controllers with high performance have these bits depending on their working same as having different set of gares for different capacity bikes .

By Default the fuse bits are set to some value. you can check it by using the commands listed in the below 

Here the value 1 indicates the "UNPROGRAMMED"
                         0 indicates  "PROGRAMMED"

High Fuse Bits:
I will give you the high fuse bits which are present in the atmega8
         Bits                            Default values
  • RSTDISBL     -->        1
  • WDTON         -->        1
  • SPIEN           -->         0
  • CKOPT          -->         1
  • EESAVE        -->         1
  • BOOTSZ1      -->         0
  • BOOTSZ0      -->         0
  • BOOTRST     -->          1
So , these are the fuse bits which are called HIGH FUSE BITS.
WDTON   --  This bit is programmed when we use the watch dog timer i.e the watch dog timer doesn't work perfectly if you don't enable this if you are using the predefined library functions.
                   [WATCH DOG TIMER RELATED BIT]
SPIEN     -- This fuse should be programmed when you are using the serial peripheral interconnect protocol and This must be always enabled if you want to communicate through this interface.
               note:  Never ever make this bit unprogrammed until you think you don,t need but you never come to this . I prefer not to touch this bit at all. let this be programmed.
                   [ SPI RELATED BIT]

CKOPT    --  This fuse is used to select whether you need the internal clock or external clock to your microcontroller. In order to understand this clearly you should be clear with clock concept and what bits are related to the clock.
                   [CLOCK RELATED BIT]

EESAVE  --  This is used while EEPROM programming . we think if we just used the EEPROM related registers and dump the values we needed into the eeprom it will store the values right no this concept some what different you should enable the EESAVE gare like gare of a byke and then program the eeprom values into the microcontroller eeprom. ok
So, what  you do is write program and burn the hex file and then set the fuses.

                     In breif microcontroller has two sections in memory locations
                     1. Application and
                     2. Bootloader section
lets about these things in detail in next coming tutorials .
These fuses are used to configure the size of the bootloader and flash they are specified in the data sheet different microcontrollers have different locations and sizes.
            Bootloader concept is a vast subject so upto to now know this only you can write the flash to itself using it . In this section all store program memory commands are executed  and in application section load program memory instructions are executed i.e: reads the falsh that it it couldn't write to flash are.
   Bootloader section    --- write to flash area of its own
   Application section   ---  Reads the flash and execute the written program .

BOOTRST -- This fuse bit is used for selecting reset position. As i said flash will have two sections . So, Two sections means we can set the RESET position to bootloader or application section. Lets say you need when ever you reset you should activate your bootloader section then PROGRAM this bit else if you want your application itself to execute after the RESET is pressed then it jumps to the location of application section 0x0000 where your application program is written.
             Reset vector to bootloader section  ---  0   (programmed)
             Reset vector to application section  ---  1  (unprogrammed)
How to burn the fuse bits: click here

You can Read next tutorial for the Low fuse bits