434
8331B–AVR–03/12
Atmel AVR XMEGA AU
selected page buffer location to tag them. When performing an EEPROM page erase, the actual
value of the tagged location does not matter.
The EEPROM page buffer is automatically erased after:
• A system reset
• Executing the write EEPROM page command
• Executing the erase and write EEPROM page command
• Executing the write lock bit and write fuse commands
33.7
Flash and EEPROM Programming Sequences
For page programming, filling the page buffers and writing the page buffer into flash or EEPROM
are two separate operations. The sequence is same for both self-programming and external
programming.
33.7.1
Flash Programming Sequence
Before programming a flash page with the data in the flash page buffer, the flash page must be
erased. Programming an un-erased flash page will corrupt its content.
The flash page buffer can be filled either before the erase flash Page operation or between a
erase flash page and a write flash page operation:
Alternative 1:
• Fill the flash page buffer
• Perform a flash page erase
• Perform a flash page write
Alternative 2:
• Fill the flash page buffer
• Perform an atomic page erase and write
Alternative 3, fill the buffer after a page erase:
• Perform a flash page erase
• Fill the flash page bufferPerform a flash page write
The NVM command set supports both atomic erase and write operations, and split page erase
and page write commands. This split commands enable shorter programming time for each
command, and the erase operations can be done during non-time-critical programming execu-
tion. When using alternative 1 or 2 above for self-programming, the boot loader provides an
effective read-modify-write feature, which allows the software to first read the page, do the nec-
essary changes, and then write back the modified data. If alternative 3 is used, it is not possible
to read the old data while loading, since the page is already erased. The page address must be
the same for both page erase and page write operations when using alternative 1 or 3.
33.7.2
EEPROM Programming Sequence
Before programming an EEPROM page with the tagged data bytes stored in the EEPROM page
buffer, the selected locations in the EEPROM page must be erased. Programming an unerased
EEPROM page will corrupt its content. The EEPROM page buffer must be loaded before any
page erase or page write operations: