6.5.7.1.8 Programming a Flash Page

Table 6-25. Programming a Flash Page Sequence
StepsCommands
Enable automatic writesdap_write_word(NVMCTRL_CTRLB, NVMCTRL_CMD_FLWR);
Wait for Unlock to completewhile (0 == (dap_read_word(NVMCTRL_INTFLAG) & 1));
<begin loop>
Write Datadap_write_word(addr, data);
Wait for Write to completewhile (0 == (dap_read_word(NVMCTRL_INTFLAG) & 1));
<end loop>
Disable the Write Commanddap_write_word(NVMCTRL_CTRLB, NVMCTRL_CMD_NOCMD);

This sequence assumes that the page is not locked by LOCK fuses or BOOTPROT.