Partial erase of a page in flash

Partial erase is a feature in the NVMC to split a page erase time into shorter chunks, so this can be used to prevent longer CPU stalls in time-critical applications. Partial erase is only applicable to the code area in flash and does not work with UICR. It can only be performed in secure mode.

When partial erase is enabled in CONFIG, the partial erase of a flash page can be started by writing 0xFFFFFFFF into the first 32-bit word of a page. The duration of a partial erase can be configured in ERASEPAGEPARTIALCFG. A flash page is erased when its erase time reaches tERASEPAGE. Perform partial erase N number of times so that N * ERASEPAGEPARTIALCFGtERASEPAGE, where N * ERASEPAGEPARTIALCFG gives the cumulative (total) erase time. Every time the cumulative erase time reaches tERASEPAGE, it counts as one erase cycle.

For every partial erase a setup time tERASEPAGEPARTIAL,setup is added, so that the total duration for each partial erase is ERASEPAGEPARTIALCFG + tERASEPAGEPARTIAL,setup.

After the erase is done, all bits in the page are set to '1'. The CPU is stalled if the CPU executes code from the flash while the NVMC performs the partial erase operation.

The bits in the page are undefined if the flash page erase is incomplete, i.e. if a partial erase has started but the total erase time is less than tERASEPAGE.