
9
0943E–AVR–08/08
AVR910
The Lock bits will only prevent the programming interface from altering memory contents. The
core can read the Flash program memory and access the EEPROM as usual, independent of
the Lock bit setting.
The only method to regain access to the memory after setting the lock bits, is by erasing the
entire chip with a “Chip Erase” command. The lock bits will be cleared to 1, disabling the protec-
tion, only following a successful clearing of all memory locations.
On Chip Erase, the Lock bits obtain the value 1, indicating the bit is cleared. Although the opera-
tion of enabling the protection is referred to as “setting” the Lock bit, a zero value should be
written to the bit to enable protection.
Chip Erase Operation
Before new contents can be written to the Flash Program Memory, the memory has to be
erased. Without erasing, it is only possible to program bits in Flash memory to zero, not selec-
tively setting a bit to one. Erasing the memory is performed with the “Chip Erase” command.
This command will erase all memory contents, both Flash Program Memory and EEPROM.
Only after a successful erase of the memory, the Lock bits will be erased. This method ensures
that data in the memories are kept secured until all data have been completely erased.
After a Chip Erase, all memory contents will be read as $FF.
The only way to end a Chip Erase cycle is by temporarily releasing the Reset line.
Table 11. Lock Bits Protection Modes
Lock Bit 1
Lock Bit 2
Protection Type
1
1
No Memory Lock
0
1
Further Programming of both Flash and EEPROM Disabled
0
0
Further Programming and Verification of both Flash and EEPROM
Disabled
Table 12. Example, Setting Lock Bit 1 to Disable Further Programming
Action
MOSI, Sent to
Target AVR
MISO, Returned from
Target AVR
Set Lock Bit 1, Disable Programming
$AC FD xx yy
$zz AC FD xx
Wait N ms
Table 13. Example, Erasing all Flash Program Memory and EEPROM Contents
Action
MOSI, Sent to
Target AVR
MISO, Returned from
Target AVR
Erase Chip
$AC 8x yy nn
$zz AC 8x yy
Wait N ms
Release RESET to end the erase