0

nRF52832 Disable Access Port protection

Michal L. gravatar image

asked 2017-08-11 15:29:09 +0200

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?

edit retag flag offensive close delete report spam

1 answer

Sort by ยป oldest newest most voted
2
turboj gravatar image

answered 2017-08-11 16:31:04 +0200

You cannot write one values into flash like UICR. Read the manual: You have to completely erase the UICR block or the entire flash.

edit flag offensive delete publish link more

Comments

You're right..

"The NVMC is only able to write '0' to bits in the Flash that are erased, that is, set to '1'. It cannot write back a bit to '1'."

Thank you..

Michal L. ( 2017-08-11 17:57:01 +0200 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower

Stats

Asked: 2017-08-11 15:29:09 +0200

Seen: 76 times

Last updated: aug. 11