10
AVR1612
8282A-AVR-11/10
3.4.1 Chip Erase
The Chip Erase command is used to erase the Flash Program Memory, EEPROM
and Lock-Bits. The User Signature Row, Calibration Row and Fuses are not affected.
The Chip Erase sequence is as below:
1. Load the NVM CMD register with Chip Erase command (refer to
2. Set the CMDEX bit in NVM CTRLA register.
NOTE
The Chip Erase command disables the PDI controller and the NVM. Poll the NVMEN
bit until this is set, indict the PDI controller is enabled.
3.4.2 Program Flash and EEPROM Page
Flash and EEPROM page programming is done by first filling the associated page
buffer, and then writing the entire page buffer to a selected page in Flash or
EEPROM.
The size of the page buffers depend on the Flash and EEPROM size in each device,
and details on page size and page number is described in each device data sheet.
3.4.2.1 Flash and EEPROM Programming Sequence
Before programming a Flash or EEPROM page with the data in the Flash or
EEPROM page buffer, the Flash or EEPROM page must be erased. Programming an
un-erased Flash or EEPROM Page will corrupt the content in the Flash or EEPROM
Page.
1. Erase Flash or EEPROM Page Buffer.
2. Load the Flash or EEPROM Page Buffer.
3. Perform a Page Erase and Write.
3.4.2.2 Erase Page Buffer
The Erase Flash Page Buffer and Erase EEPROM Page Buffer commands are used
to erase the Flash and EEPROM page buffers.
1. Load the NVM CMD register with the Erase Flash/EEPROM Page Buffer
command.
2. Set the CMDEX bit in the NVM CTRLA register. This requires the timed CCP
sequence during self-programming.
The BUSY flag in the NVM STATUS register will be set until the operation is
completed.
3.4.2.3 Load Page Buffer
The Load Flash Page Buffer and Load EEPROM Page Buffer commands are used to
load one byte of data into the Flash and EEPROM page buffers.
1. Load the NVM CMD register with the Load Flash/EEPROM Page Buffer
command.
2. Write the selected memory address by doing a PDI Write operation.
Since the Flash page buffer is word accessing and the PDI uses byte addressing, the
PDI must write the Flash Page Buffer in correct order.