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");
}
}