Use the standard Serial Wire Debug (SWD)
Arm®
CoreSight™
Debug Access Port (DAP) protocol to write data into flash.
-
Set the CONFIG register of
the NVMC to WEN.Wen by writing 0x00000001 to
the following addresses:
- Application core - 0x50039504
- Network core - 41080504
This enables writing to the non-volatile memory.
-
Read the READY register (0x50039400) of the NVMC until the value is
0x00000001. Read the
following addresses:
- Application core - 0x50039400
- Network core - 0x41080400
When this value is read, the NVMC is ready and not currently performing any
operations.
-
Write the data to the desired, word-aligned address.
-
Read the READY register of the NVMC
until the value is 0x00000001 before continuing to ensure the
write operation has completed. Read the following
addresses:
- Application core - 0x50039400
- Network core - 0x41080400
-
Continue writing and then reading the READY register as necessary.
-
Set the CONFIG register of the NVMC to WEN.Ren by writing
0x00000000 to the following addresses:
- Application core - 0x50039504
- Network core - 41080504
This configures the non-volatile memory as
read-only.
The ranges of writeable addresses are:
- User Information Configuration Registers (UICR) addresses (located in addresses 0x00FF8000 through 0xFF8FFC for the application core, 0x01FF8000 through 0x01FF8FFC for the network core)
- All program flash (located in addresses 0x00000000 through ((INFO.CODESIZE * INFO.CODEPAGESIZE) – 0x4)
You can write to flash using different methods. For nRF5340, a good flash algorithm should take around 11 seconds to write the entire flash to the application core, and around 3 seconds for the network core. If you cannot achieve this time, contact Nordic Semiconductor for assistance.