UICR values not stable

During the End Of Line test of one of our device, based on nRF52832, we write the serial number of the device in some non volatile registers, specifically CUSTOMER[8] and CUSTOMER[9].

We realized that some time the writing procedure was failing, leaving in the registers something very similar, but not equal, to what was intended to be written.
For this reason, we added a procedure to check the rightness of the writing and, in case of failure, the overall EOL test procedure fails and we reprogram the device starting from scratch.
Occasionally, it happens. It is annoying, but manageable (around 0.5% of cases).
What worries us more is what we have recently discovered. 
We have a couple of devices that present themselves with different names at different times. 
Usually the two names differ for just one bit. For example one of them it advertise itself as  AJTCDNZ" instead of AJTWDNZ".
The difference between the right character is just one bit: 0x43 vs 0x53.
How is possible? Is possible that sometime CUSTOMER memory region is written "poorly" and the readback is "volatile"?
Please see below the code we use to write the CUSTOMER registers. We are trying to get the device back to further investigate and read back the memory area via JTAG, to see if the content of the area is valid and persistent.
Thank you for your thoughts.
Andrea

// Switch off SD and BLE 

if (!BLE_and_SD_DEInit()) return;

CRITICAL_REGION_ENTER();

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

uint32_t chunk;

chunk = 0;
for (uint8_t i = 0; i < 4; i++ )
{
chunk |= bf[i] << (i * 8);
}

NRF_UICR->CUSTOMER[8] = chunk;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

chunk = 0;
for (uint8_t i = 0; i < 3; i++ )
{
chunk |= bf[i + 4] << (i * 8);
}

NRF_UICR->CUSTOMER[9] = chunk;
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){}

CRITICAL_REGION_EXIT();
return;

Parents Reply Children
No Data
Related