11.3.2.1 Programming
Flash programming is done by writing one byte or one word at a time. Writing from the CPU using store type instructions (ST*) will write one byte at a time, while a write with the Store Program Memory (SPM) instruction will write one word at a time.
The NVMCTRL command set supports multiple Flash erase operations. Up to 32 pages can be erased at the same time. The duration of the erase operation is independent of the number of pages being erased.
The EEPROM erasing has byte granularity with the possibility of erasing up to 32 bytes in one operation. The EEPROM is written one byte at a time, and it has an option to do the erase and write of one byte in the same operation.
The User Row is erased/written as an ordinary Flash. When the erasing operation is used, the entire User Row is erased at once. The User Row writing has byte granularity.
The Fuse programming is identical to the EEPROM programming, but it can be performed only via the UPDI interface.
Memory Section | Erase Granularity | Write Granularity |
---|---|---|
Flash array | Page | Word(1) |
EEPROM array | Byte | Byte |
User Row | Page(2) | Byte(3) |
Boot Row | Page(2) | Byte |
Fuses | Byte | Byte |
- Byte granularity when writing to the CPU data space memory mapped section.
- One page is 512 bytes.
- Page granularity when programming from UPDI on a locked device.