
302
8210C–AVR–09/11
Atmel AVR XMEGA D
24.11.2.3
Load Flash Page Buffer
The load flash page buffer command is used to load one word of data into the flash page buffer.
1.
Load the NVM CMD register with the load flash page buffer command.
2.
Load the Z-pointer with the word address to write.
3.
Load the data word to be written into the R1:R0 registers.
4.
Execute the SPM instruction. The SPM instruction is not protected when performing a
flash page buffer load.
Repeat step 2-4 until the complete flash page buffer is loaded. Unloaded locations will have the
value 0xFFFF.
24.11.2.4
Erase Flash Page
The erase flash page command is used to erase one page in the flash.
1.
Load the Z-pointer with the flash page address to erase. The page address must be
written to FPAGE. Other bits in the Z-pointer will be ignored during this operation.
2.
Load the NVM CMD register with the erase flash page command.
3.
Execute the SPM instruction. This requires the timed CCP sequence during self-
programming.
The BUSY flag in the NVM STATUS register will be set until the erase operation is finished. The
flash section busy (FBUSY) flag is set as long the flash is busy, and the application section can-
not be accessed.
24.11.2.5
Write Flash Page
The write flash page command is used to write the flash page buffer into one flash page in the
flash.
1.
Load the Z-pointer with the flash page to write. The page address must be written to
FPAGE. Other bits in the Z-pointer will be ignored during this operation.
2.
Load the NVM CMD register with the write flash page command.
3.
Execute the SPM instruction. This requires the timed CCP sequence during self-
programming.
The BUSY flag in the NVM STATUS register will be set until the write operation is finished. The
FBUSY flag is set as long the flash is busy, and the application section cannot be accessed.
24.11.2.6
Flash Range CRC
The flash range CRC command can be used to verify the content in an address range in flash
after a self-programming.
1.
Load the NVM CMD register with the flash range CRC command.
2.
Load the start byte address in the NVM address register (NVM ADDR).
3.
Load the end byte address in NVM data register (NVM DATA).
4.
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, and the CPU is halted during the execu-
tion of the command.
The CRC checksum will be available in the NVM DATA register.