9 Jul 2012

LocK Bits in detail

LOCK BITS :

          Before we discuss these bits lets take a practical example in day to day life until now we are dealing with the byke example right . we discussed fuses are like gares which are used to ride the microcontroller and in the same way you protect your byke with a Lock right to protect it from being stolen . In the same way you have your developed a project and now you burn this code to the microcontroller there are chances that someone can hack your code from it right so in order to protect your code you lock your microcontroller after all the code is written one time . so that others cannot steel your code.

You have different combination of locks over here for that You refer the data sheet MEMORY PROGRAMMING section you will mostly find this information at the beginning itself ok.

Real time scenario:
           Ya assume that you wrote a bootloader . Now your bootloader is writting your application section from bootloader section so while writting you should be careful that it never erases or never writes into the bootloader section so you need to lock that perticular section in order to disable the access to that section ok. Now By using the lock bits you can do this protection .

Ya i will explain you the lock bits in atmega8 ok......

Same way as fuse bits here also
0 --> Programmed
1 --> Unprogrammed

Lock bits are 6 in number
     ------               Reserved
     ------               Reserved
1. BLB12   --      1
2. BLB11   --      1
3. BLB02   --      1
4. BLB01   --      1
5. BL2       --      1 
6. BL1       --      1

Selecting the BL2  & BL1 is based on your requirement the below values you use
                        1          1          -->    No memory lock features
                        1          0          -->    Disable programming Flash and EEPROM
                        0          1          -->    Disable programming and verification of Flash and EEPROM in any mode.

In the same way comes
BLB02 &BLB01 (APPLICATION PART)
    1             1            -->   No restrictions for SPM or LPM for accessing APP sec.
    1             0            -->   SPM NO write to APP sec.
    0             0            -->   1. NO write to APP sec by the SPM.
                                         2. LPM executing from the bootloader section is not allowed to read from APP sec.
                                         3. If Interrupt vectors are placed in BOOT  sec interrupts are disabled while executing from the APP section.
    0             1            -->    only ( 2 ) & ( 3 ) points are enabled.   

BLB12 & BLB11  (BOOTLOADER PART):
    1             1            -->   

      



1 comment: