11.3.2.3 Programming

For page programming, filling the page buffer and writing the page buffer into Flash, User Row, and EEPROM are two separate operations.

Before programming a Flash page with the data in the page buffer, the content of the Flash page must be erased (read back 0xFF). Programming a Flash page that has not been erased will corrupt its content.

Two options are available to make sure that the Flash page content is programmed correctly:

Option 1: The Flash is programmed using one command that handles both erase and write.
  1. Make sure the Flash is ready by reading the Flash Busy (FLBUSY) flag in the NVMCTRL.STATUS register.
  2. Fill the page buffer.
  3. Write the page buffer to Flash with the Flash Page Erase and Page Write (FLPERW) command.
Option 2: The Flash is programmed using separate commands for page erase and page write.
  1. Make sure the Flash is ready by reading the Flash Busy (FLBUSY) flag in the NVMCTRL.STATUS register.
  2. Write to a location on the page to set up the address.
  3. Perform a Flash Page Erase (FLPER) command.
  4. Fill the page buffer.
  5. Perform a Flash Page Write (FLPW) command.

The NVM command set supports both single Page Erase and Write (FLPERW/EEPERW) operations and split Page Erase (FLPER/EEPER) and Page Write (FLPW/EEPW) commands for both Flash and EEPROM. These split commands enable a shorter programming time for each command, and the erase operations can be done during non-time-critical programming execution.

The EEPROM programming is similar to Flash programming, but only the bytes updated in the page buffer will be written or erased in the EEPROM.

Table 11-4. Programming Granularity
Memory Section Erase Granularity Write Granularity
Flash array Page Page
EEPROM array Byte Byte
User Row Page(1) Page(1)
Note:
  1. User Row page is 64 bytes.