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
  • You should make sure your application does not overwrite the flash area where the data is stored. In order to overwrite written data, you will have to perform an erase. If your application, or you do not erase the flash, the data will not be overwritten. The best approach is to place the data in the upper region of flash, and reduce the flash size settings in your project to avoid that the application grows into this area.

Children
No Data
Related