I am using nrf52832_xxaa with SDK v11.0. I have a requirement to write into UICR register APPROTECT to set its value to 0x00. Is it possible?If yes, please provide a sample code.
I am using nrf52832_xxaa with SDK v11.0. I have a requirement to write into UICR register APPROTECT to set its value to 0x00. Is it possible?If yes, please provide a sample code.
Yes, it's possible. Try this code:
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
NRF_UICR->APPROTECT = 0xFFFFFF00;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
Or with nrfjprog:
nrfjprog --memwr 0x10001208 --val 0xffffff00
(also note that UICR registers are loaded at the start-up so to make it effective you need to reset the chip at least once, whatever method you use...)
(also note that UICR registers are loaded at the start-up so to make it effective you need to reset the chip at least once, whatever method you use...)