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

  • > 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.

Related