6.1.8.1 Page Erase
A page erase performs an erase of a single page of the main program, boot/configuration or sector redundancy Flash. 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 to erase a page:
- 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 (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 NVMCOM.NVMWR bit. This generates an interrupt. - Set NVMCON.WREN =
- Clear the NVMCON.NVMWREN bit.
- Check the NVMCON.NVMERR and NVMCON.BORERR bits to ensure that the erase sequence completes successfully.