Product Specs

Table Of Contents
11 NVMC Non-volatile memory controller
Page
29
11
NVMC Non-volatile memory controller
The Non-volatile memory controller (NVMC) is used for writing and erasing the internal Flash memory and
the UICR.
Before a write can be performed, the NVMC must be enabled for writing in CONFIG.WEN. Similarly, before
an erase can be performed, the NVMC must be enabled for erasing in CONFIG.EEN, see CONFIG on page
31. The user must make sure that writing and erasing are not enabled at the same time. Failing to do so
may result in unpredictable behavior.
11.1 Writing to Flash
When writing is enabled, the Flash is written by writing a full 32-bit word to a word-aligned address in the
Flash.
The NVMC is only able to write '0' to bits in the Flash that are erased, that is, set to '1'. It cannot write back a
bit to '1'.
As illustrated in Memory on page 23, the Flash is divided into multiple pages that are further divided into
multiple blocks. The same block in the Flash can only be written n
WRITE
number of times before an erase
must be performed using ERASEPAGE or ERASEALL. See the memory size and organization in Memory on
page 23 for block size.
Only full 32-bit words can be written to Flash using the NVMC interface. To write less than 32 bits to Flash,
write the data as a word, and set all the bits that should remain unchanged in the word to '1'. Note that the
restriction about the number of writes (see above) still applies in this case.
The time it takes to write a word to the Flash is specified by t
WRITE
. The CPU is halted while the NVMC is
writing to the Flash.
Only word-aligned writes are allowed. Byte or half-word-aligned writes will result in a hard fault.
11.2 Erasing a page in Flash
When erase is enabled, the Flash can be erased page by page using the ERASEPAGE register.
After erasing a Flash page, all bits in the page are set to '1'. The time it takes to erase a page is specified by
t
ERASEPAGE
. The CPU is halted while the NVMC performs the erase operation.
11.3 Writing to user information configuration registers (UICR)
User information configuration registers (UICR) are written in the same way as Flash. After UICR has been
written, the new UICR configuration will only take effect after a reset.
UICR can only be written n
WRITE
number of times before an erase must be performed using ERASEUICR or
ERASEALL.
The time it takes to write a word to the UICR is specified by t
WRITE
. The CPU is halted while the NVMC is
writing to the UICR.
11.4 Erasing user information configuration registers (UICR)
When erase is enabled, UICR can be erased using the ERASEUICR register.
After erasing UICR all bits in UICR are set to '1'. The time it takes to erase UICR is specified by t
ERASEPAGE
.
The CPU is halted while the NVMC performs the erase operation.