381
XMEGA B [DATASHEET]
8291B–AVR–01/2013
Depending on the programming operation, if any of these V
CC
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.
30.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 323
30.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, production signature row, and fuses, and read
and write the EEPROM.
30.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 software 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 out the
program memory code. It has the capability to write into the entire flash, including the boot loader section. The boot
loader can thus modify itself, and it can also erase itself from the flash if the feature is not needed anymore.
30.11.1.1 Application and Boot Loader Sections
The application and boot loader sections in the flash are different when it comes to self-programming.
When erasing or writing a page located inside the application section, the boot loader section can be read
during the operation, and thus the CPU can run and execute code from the boot loader section
When erasing or writing a page located inside the boot loader section, the CPU is halted during the entire
operation, and code cannot execute
The user signature row section has the same properties as the boot loader section.
Table 30-1. Summary of self-programming functionality.
30.11.1.2 Addressing the Flash
The Z-pointer is used to hold the flash memory address for read and write access. For more details on the Z-pointer,
refer to
“The X-, Y-, and Z- Registers” on page 11
.
Since the flash is word accessed and organized in pages, the Z-pointer can be treated as having two sections. The least-
significant bits address the words within a page, while the most-significant bits address the page within the flash. This is
shown in
. The word address in the page (FWORD) is held by the bits [WORDMSB:1] in the Z-
pointer. The remaining bits [PAGEMSB:1] in the Z-pointer hold the flash page address (FPAGE). Together
FWORD and FPAGE holds an absolute address to a word in the flash.
Section being Addressed during Programming
Section that can be Read during Programming
CPU halted?
Application section
Boot loader section
No
Boot loader section
None
Yes
User signature row section
None
Yes
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...