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

Erasing UICR register in application code

Hello Everyone,

I am using nrf51822 with S130. After completely erasing the chip, with the below mentioned code snippet in application code:

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;

while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

*(uint32_t *)0x10001080 = hexData;

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;

while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

I am able to write data in the UICR register. I tried subsequent writing to UICR using the same code in the application code, however, UICR data doesn't change. Based on further research I came to know that the entire chip needs to be erased for writing new data. However, I want to just erase UICR to rewrite new data to the UICR. Is there any way to erase the UICR registers in application code to rewrite new data?

Thanks

Parents Reply
  • Hello John,

    Thank you for your reply. I tried erasing the UICR using following code:

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;

    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

    NRF_NVMC->ERASEUICR = 1;

    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

    But it doesn`t work. I followed this forum :devzone.nordicsemi.com/.../ which mentions that ERASEUICR is not available functionality on all chip configurations. It is only available when there is a pre-programmed factory code is present in the chip.

Children
No Data
Related