Unable to write correct values to UICR:CUSTOMER[0..3]

Hi there!

My set up is: Windows 11 x64, nRF5 SDK 17.0.2, Segger Embedded Studio Release 5.40c. Project is based on "ble_app_hrs_freertos"

I'm trying to write 4 x 32-bit values to UICR:CUSTOMER[0..3] that is erased (contains 0xFFFF_FFFF) but when I read back the values they do not match. It contains random "garbage". Here is my example code:

const uint32_t uicr_customer[4] = {0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00};

void uicr_customer_wr_test(void)
{
    bool sd_enabled;

    sd_enabled = nrf_sdh_is_enabled();
    if(sd_enabled) nrf_sdh_disable_request();
    __disable_irq();
    for(int i = 0; i < 4; i++)
    {
        nrfx_nvmc_word_write((uint32_t)(&NRF_UICR->CUSTOMER[i]), uicr_customer[i]);
        while(!nrfx_nvmc_write_done_check()) {;}
    }
    __enable_irq();
    if(sd_enabled) nrf_sdh_enable_request();
}

Am I using the correct / recommended API to disable the SoftDevice correctly?

Any help / hints will be much appreciated!

Thanks in advance,

Pieter

Parents Reply Children
No Data
Related