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

UICR register is not retaining it's value after --program command line tool

Hello All,

I am working with BMD300 eval kit and trying to achieve one functionality with UICR CUSTOMER[20] register.

I am fcaing an issue where, UICR CUSTOMER[20] register content is erase if I flash the HEX file through command line tool. Initially I was trying with --chiperase but after reading I did tried without using any command in addition to --program and also tried using --sectorerase to retain my  UICR content. But both failed.

But the same case, if I flash the HEX file through SES IDE, the UICR register content is retained even after multiple reboots.

Steps followed as below,

1. nrfjprog -f NRF52 --eraseall

2. nrfjprog --memwr 0x100010D0 --val 0x00001234

3. nrfjprog.exe -r -f NRF52 --sectorerase --program binary.hex

Below is my code in main(). Used LED for indication.

#define LED_RED 17

#define UICR_EOL_TESTMODE_CUSTOMER_REGIDX   20

int main(void)
{
uint32_t uicr_testmode = 0;
nrf_gpio_cfg_output(LED_RED );
nrf_gpio_pin_write(LED_RED , 1); // Turn off LED
/* Read UICR CUSTOMER[20] register for EOL test mode */
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
uicr_testmode = NRF_UICR->CUSTOMER[UICR_EOL_TESTMODE_CUSTOMER_REGIDX];
printf("uicr_testmode = %lu \r\n", (unsigned long)uicr_testmode );

/* if UICR CUSTOMER[20] register value is 0x1234 then enter EOL test mode */
if (uicr_testmode == 0x1234)
{
//nrf_gpio_pin_write(LED_BLUE, 0); // Turn on LED
/* Enter into EOL test mode */
printf("Entered uicr test mode \r\n");
while(1);
}
else
{

printf("not Entered uicr test mode \r\n");

}

}

Parents
  • Hello,

    Do you know if your binary.hex might be including any data in the UICR region? The --sectorerase option will force an erase of the UICR section in that case (i.e. delete any UICR written prior to nrfjprog.exe -r -f NRF52 --sectorerase --program binary.hex). Either way, could you please try to read back the register with nrfjprog to confirm what the value is?

    e.g.

    $ nrfjprog --memrd 0x100010D0 

Reply
  • Hello,

    Do you know if your binary.hex might be including any data in the UICR region? The --sectorerase option will force an erase of the UICR section in that case (i.e. delete any UICR written prior to nrfjprog.exe -r -f NRF52 --sectorerase --program binary.hex). Either way, could you please try to read back the register with nrfjprog to confirm what the value is?

    e.g.

    $ nrfjprog --memrd 0x100010D0 

Children
  • Thanks for the answer.

    Looks like, there is not no issue with the UICR register retaining the data. These registers retaining data even after programming with sector erase option.

    Read is returning the correct value. But issue is with RTT viewer where RTT viewer is not sending input if I flash thorugh command line.

    Will create another ticket with RTT viewer issue. Thanks.

Related