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

nRF52832 Disable Access Port protection

Hi,

I'm able to successfully enable Access Port protection, either using nrfjprog or by setting NRF_UICR->APPROTECT register to 0xFFFFFF00 in code.

But I have a problem if I want to perform inverse operation - disable Access Port protection. I do it same way as in case of enable, but the value of APPROTECT is now 0xFFFFFFFF. Here is a code:

NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
			
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
	// Do nothing.
}
	
NRF_UICR->APPROTECT = 0xFFFFFFFF;
				
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
	// Do nothing.
}
				
// Turn off flash write enable and wait until the NVMC is ready:
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);

while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
	// Do nothing.
}

When I run this code, CPU is still protected. I also tried to perform this by setting specific memory place to desired value and result is the same - protection is still enabled.

What am I doing wrong?

Related