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].
// 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;
