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

uicr config issue

Hi,

i have been struggling with UICR Config in nrf52. The code:

NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

seems to crash program execution. The chip is not freezing, but somehow stops correct execution in a random place. Sometimes in just puts some flash content through the RTT. Looks like a "oops" error or something similar. I had to "walk around" with check before write:

if(!(NRF_NVMC->CONFIG&(NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos)))
	{
		NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
	}
while (NRF_NVMC->READY == NVMC_READY_READY_Busy);

did I messed up something in here?

I want to be always sure to have "Ren" when read, "Wen" when written etc. and this check should be unnecessary.

thanks

Related