6.7.3.2 PFM Region Erase
The whole PFM can be erased using the PFM_REGION_ERASE NVMOP command. This command leaves the boot or config Flash intact. The whole PFM region can be erased if its associated page write protection is not enabled.
Follow this sequence of steps for the PFM region erase:
- Run the following unlock sequence using the PFM
erase command to start the sequence.
- Set NVMCON.WREN = 1 (allow writes to NVMCON.NVMWR) and set NVMCON.NVMOP to PFM_REGION_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 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.