3.4.3 Chip Erase Operation

Before new content 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 3-11. Example, Erasing all Flash Program Memory and EEPROM Contents
ActionMOSI, sent to the target AVRMISO, returned from the target AVR
Erase Chip$AC 8x yy nn$zz AC 8x yy
Wait N ms
Release RESET to end the erase