6.1.6.3.1 Page Erase
A page erase performs an erase of a single page of main program (PFM), boot/configuration (BFM). The page to be erased is selected using NVMADDR. The lower bits of the address given by NVMADDR are ignored in page selection. A page of Flash can be erased if its associated page write protection is not enabled.
Follow this sequence of steps for page erase:
- Set NVMADDR with the address of the page to be erased.
- Run the following unlock sequence using the page erase command to start the sequence:
- Set NVMCON.WREN = 1 (allow writes to NVMCON.NVMWR) and set NVMCON.NVMOP to PAGE_ERASE_NVMOP (using a single write)
- Set NVMKEY = 0x00000000 (Reset key)
- Set NVMKEY = 0xAA996655
- Set NVMKEY = 0x556699AA
- Write to the target register NVMCONSET to set the NVMWR bit (not the NVMCON register itself). This begins the FC operation.
Note: The erase sequence completes when the hardware clears the NVMCON.NVMWR bit. This generates an interrupt. - Clear the NVMCON.NVMWREN bit.
- Check the NVMCON.NVMERR and NVMCON.BORERR bits to ensure that the erase sequence is completed successfully.
