384
XMEGA B [DATASHEET]
8291B–AVR–01/2013
30.11.2.2 Erase Flash Page Buffer
The erase flash page buffer command is used to erase the flash page buffer.
1.
Load the NVM CMD with the erase flash page buffer command.
2.
Set the command execute bit (NVMEX) in the NVM control register A (NVM CTRLA). This requires the timed CCP
sequence during self-programming.
The NVM busy (BUSY) flag in the NVM status register (NVM STATUS) will be set until the page buffer is erased.
30.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.
30.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 cannot be accessed.
30.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.
30.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 execution of the command.
The CRC checksum will be available in the NVM DATA register.
In order to use the flash range CRC command, all the boot lock bits must be unprogrammed (no locks). The command
execution will be aborted if the boot lock bits for an accessed location are set.
30.11.2.7 Erase Application Section
The erase application command is used to erase the complete application section.
1.
Load the Z-pointer to point anywhere in the application section.
2.
Load the NVM CMD register with the erase application section command
Summary of Contents for XMEGA B
Page 320: ...320 XMEGA B DATASHEET 8291B AVR 01 2013 Table 25 12 7 segments Character Table...
Page 321: ...321 XMEGA B DATASHEET 8291B AVR 01 2013 Table 25 13 14 segments Character Table...
Page 322: ...322 XMEGA B DATASHEET 8291B AVR 01 2013 Table 25 14 16 segments Character Table...
Page 412: ...412 XMEGA B DATASHEET 8291B AVR 01 2013...
Page 413: ...413 XMEGA B DATASHEET 8291B AVR 01 2013...