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

NVMC write is not possible after softDevice initialization

Hi,

I want to write to the NVMC UICR Customer[n] memory addresses during code execution.

 //----------------ERASING/WRITING TO NVMC UICR---------------------
   NRF_LOG_INFO( "%x", NRF_UICR->CUSTOMER[0]);                                                // Read current data

   NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;                             // Erase Enable
   while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

   NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase << NVMC_ERASEUICR_ERASEUICR_Pos;      // Erase UICR
   while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

   NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;                             // Write Enable
   while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

   NRF_UICR->CUSTOMER[0] = 0xDEADBEEF;                                                        // Write new Value 
   while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

   NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
   while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
   NRF_LOG_INFO( "%x", NRF_UICR->CUSTOMER[0]);

   //--------------------------------------------------------------

I noticed that I can write/read/erase those addresses only before the initialization of the softDevice

When I try to execute the same code after softDevice initialization I can only read but not write or erase those addresses

What am I missing here?

Thank you for your time

Related