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

Erase UICR CUSTOMER registers

Hello,

I'm a little consufed about the page I need to erase before I can write again on the UICR CUSTOMER registers. Is there a way to erase only the UICR CUSTOMER registers?

Thank you

Parents
  • UICR customer registers are meant to be stored with values that are supposed to stay there during the life time of the softdevice. you cannot erase them without erasing everything on chip.

    if you want persistant storage that you need to modify now and then, use pstorage module which will give you one page (1024 bytes) and you can write/read/modify single or multiple words in that page . There is really good documentation for it in SDK and many have used it and tested to be working OK. This module is designed to work well even with ongoing radio activity.

  • > you cannot erase them without erasing everything on chip.

    This is definitely not true and this should not be the accepted answer. I know because I erase and rewrite the UICR all the time and the application is perfectly intact at runtime and after reset. This application has been stable for several years and does this all the time.

    I now realize this isn't the intended use of the UICR - but it is DEFINITELY NOT CORRECT that you must erase the whole chip to erase the UICR.

    This is the function we use and it definitely works perfectly well on both the 52832 and 52833.

    =========

    void APP__write_customer_register(uint32_t data, int reg)
    {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een;
        NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase;
        IAP__nvmc_wait_until_ready();

        NRF_UICR->CUSTOMER[reg] = data;
        IAP__nvmc_wait_until_ready();
        
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
        IAP__nvmc_wait_until_ready();
    }

    =================

  • If you have a preprogrammed factor code on your nRF51, it might work as mentioned here, else it can work with nRF52 series.

Reply Children
No Data
Related