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

How to write data to UICR CUSTOMER registers?

I have some keyword, want to save to UICR CUSTOMER registers. Then, when I start he board, I can get the data from UICR CUSTOMER registers. but, I donot know how to ?

Functional description The User Information Configuration Registers (UICRs) are NVM registers for configuring user specific settings. Code readback protection of the whole code area, or a part of the code area can be configured and enabled in the UICR. The UICR can only be erased by using ERASEALL. The code area can be divided into two regions, code region 0 (CR0) and code region 1 (CR1). Code region 0 starts at address 0x00000000 and stretches into the code area as specified in the CLENR0 register. The area above CLENR0 will then be defined as code region 1. If CLENR0 is not configured, that is, has the value 0xFFFFFFFF, the whole code area will be defined as code region 1 (CR1). Code running from code region 1 will not be able to write to code region 0. Additionally, the content of code region 0 cannot be read from code running in code region 1 or through the SWD interface if code region 0 is readback protected, see PR0 in RBPCONF. The main readback protection mechanism that will protect the whole code, that is, both code region 0 and code region 1, is also configured through the UICR. The PAGEERASE command in NVMC will only work for code region 1. See NVMC chapter for information on how to erase and program the code area and the UICR.

I follow it as above, I can not do it well.

Parents
  • unsigned long dataflash[32];

    void write32data(void) { NRF_NVMC->CONFIG=2;//FOR DEL NRF_NVMC->ERASEUICR=1; //while(NRF_NVMC->READY==0);

    NRF_NVMC->CONFIG=1;//FOR write
    for(int tmpi=0;tmpi<32;tmpi++)
    {
    	NRF_UICR->CUSTOMER[tmpi]=dataflash[tmpi];
    }
    NRF_NVMC->ERASEUICR=0;
    NRF_NVMC->CONFIG=0;//FOR READ
    

    }

    void read32data(void) { NRF_NVMC->CONFIG=0;//FOR READ for(int tmpi=0;tmpi<32;tmpi++) { dataflash[tmpi]=NRF_UICR->CUSTOMER[tmpi]; } }

    I write a some code to operate the UICR. but run in s130 with BLE will error.

Reply
  • unsigned long dataflash[32];

    void write32data(void) { NRF_NVMC->CONFIG=2;//FOR DEL NRF_NVMC->ERASEUICR=1; //while(NRF_NVMC->READY==0);

    NRF_NVMC->CONFIG=1;//FOR write
    for(int tmpi=0;tmpi<32;tmpi++)
    {
    	NRF_UICR->CUSTOMER[tmpi]=dataflash[tmpi];
    }
    NRF_NVMC->ERASEUICR=0;
    NRF_NVMC->CONFIG=0;//FOR READ
    

    }

    void read32data(void) { NRF_NVMC->CONFIG=0;//FOR READ for(int tmpi=0;tmpi<32;tmpi++) { dataflash[tmpi]=NRF_UICR->CUSTOMER[tmpi]; } }

    I write a some code to operate the UICR. but run in s130 with BLE will error.

Children
No Data
Related