This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UICR runtime write

Hi,

What is the correct way to write to UICR at runtime?

I am using the code below but the MCU crashes on the first line with no call stack trace.

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos ;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
}

/* Copy the buffer to the UICR memory */
/* Bits which are 1 can be written as 0, bits which are 0 CANNOT be written as 1 */
ptr = (uint32_t*) (0x10001090U) ;
*ptr = field ;

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos ;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
}

Thanks

Dermot

Related