Erasing all

Use the standard Serial Wire Debug (SWD) Arm® CoreSight™ Debug Access Port (DAP) protocol to erase all pages.

  1. If Secure Access Port Protection (SECUREAPPROTECT) is enabled, erase all is disabled. To erase, see either Erasing page by page or Erasing all through CTRL-AP to disable SECUREAPPROTECT.
  2. Write 0x00000002 to the CONFIG register (0x50039504) of the Non-volatile Memory Controller (NVMC).
    This configures the non-volatile memory for erasing.
  3. Read the READY register (0x50039400) of the NVMC until the value is 0x00000001.
    When this value is read, the NVMC is ready and not currently performing any operations.
  4. Write 0x00000001 to the ERASEALL register(0x5003950C) of the NVMC.
    This erases all non-volatile memory including User Information Configuration Registers (UICR) registers.
  5. Read the READY register (0x50039400) of the NVMC until the value is 0x00000001 before continuing to ensure the erase all operation has completed.
  6. Write 0x00000000 to the CONFIG register (0x50039504) of the NVMC.Set the CONFIG register of the NVMC to WEN.Ren by writing 0x00000000 to following addresses:
    This configures the non-volatile memory back to read-only.