In some devices the lock bits can not be read and

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: riting of memories on the chip. In some devices the Lock bits can not be read, and setting Lock bits can not be verified by the programmer. To check that the Lock bits have been set properly in these devices, one should attempt to alter a location in EEPROM. When Lock bit 1 is set, memory locations are not altered. When both Lock bits 1 and 2 are set, no location can be read, and the result returned will be the Low byte of the address passed in the command. Setting only Lock bit 2 will have no protective effect. Before the chip is protected from reading, it has to be successfully protected from writing. 8 AVR910 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. 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 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 protection, 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 operation of enabling the protection is referred to as “setting” the Lock bit, a zero value should be written to the bit to enable protection. 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 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 selectively 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 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 9 0943E–AVR–08/08 A Simple Low-cost This application note will not discuss all aspects of an In-System Programmer. Instead, it will show how a simple low-cost programmer can be made, using only an AT90S1200 and a few...
View Full Document

Ask a homework question - tutors are online