435
8331B–AVR–03/12
Atmel AVR XMEGA AU
Alternative 1:
• Fill the EEPROM page buffer with the selected number of bytes
• Perform a EEPROM page erase
• Perform a EEPROM page write
Alternative 2:
• Fill the EEPROM page buffer with the selected number of bytes
• Perform an atomic EEPROM page erase and write
33.8
Protection of NVM
To protect the flash and EEPROM memories from write and/or read, lock bits can be set to
restrict access from external programmers and the application software. Refer to
for details on the available lock bit settings and how to use them.
33.9
Preventing NVM Corruption
During periods when the V
CC
voltage is below the minimum operating voltage for the device, the
result from a flash memory write can be corrupt, as supply voltage is too low for the CPU and
the flash to operate properly.To ensure that the voltage is sufficient enough during a complete
programming sequence of the flash memory, a voltage detector using the POR threshold
(V
POT+
) level is enabled. During chip erase and when the PDI is enabled the brownout detector
(BOD) is automatically enabled at its configured level.
Depending on the programming operation, if any of these Vcc voltage levels are reached, the
programming sequence will be aborted immediately. If this happens, the NVM programming
should be restarted when the power is sufficient again, in case the write sequence failed or only
partly succeeded.
33.10 CRC Functionality
It is possible to run an automatic cyclic redundancy check (CRC) on the flash program memory.
When NVM is used to control the CRC module, an even number of bytes are read, at least in the
flash range mode. If the user selects a range with an odd number of bytes, an extra byte will be
read, and the checksum will not correspond to the selected range.
”CRC – Cyclic Redundancy Check Generator” on page 328
for more details.
33.11 Self-programming and Boot Loader Support
Reading and writing the EEPROM and flash memory from the application software in the device
is referred to as self-programming. A boot loader (application code located in the boot loader
section of the flash) can both read and write the flash program memory, user signature row, and
EEPROM, and write the lock bits to a more secure setting. Application code in the application
section can read from the flash, user signature row, calibration row, and fuses, and read and
write the EEPROM.
33.11.1
Flash Programming
The boot loader support provides a real read-while-write self-programming mechanism for
uploading new program code by the device itself. This feature allows flexible application soft-
ware updates controlled by the device using a boot loader application that reside in the boot
loader section in the flash. The boot loader can use any available communication interface and
associated protocol to read code and write (program) that code into the flash memory, or read