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

nrfx_nvmc.h API cannot write to UICR

Summary: nrfx_nvmc_word_write() and similar functions can't write to UICR.

(Note that we are not using the full SDK, only nrfx)

We have used the API provided by hal/nrf_nvmc.h to write to words in the UICR region. As of nrfx V2.0.0, nrf_nvmc_word_write() and similar functions were deprecated and removed.

The new functions provided by nrfx_nvmc.h do bounds checking on the write addresses, to make sure they are in the regular flash area, e.g.:

Fullscreen
1
2
3
4
·void nrfx_nvmc_word_write(uint32_t addr, uint32_t value)
{
NRFX_ASSERT(addr < flash_total_size_get());
...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But the UICR addresses are out of range of regular flash, so the NRFX_ASSERT above fails.

Is it intentional that these functions prevent UICR writes? Should we be writing UICR words with some other API functions? We will have to do low-level writes directly ourselves otherwise. Thanks.