Hello Devzone:
Would I be correct if I assume enabling APPROTECT should prevent writes into UICR? - for other readers, NO, IT CANNOT PROTECT AGAINST SOFTWARE READS/WRITES, ONLY DEBUGGER
Based on this assumption I wrote the following code to enable APPROTECT:
NRF_NVMC->CONFIG = 0x1;//NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} NRF_UICR->APPROTECT = 0x00; NRF_NVMC->CONFIG = 0x0; //NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
And I indeed observed my writes into UICR are invalid because I can't read back the same values I wrote, read values are only 0xFFFFFFFFs.
The problem is now I can't re-enable UICR writes.
I thought replacing 2nd line in the above code with
NRF_UICR->APPROTECT = 0xFF;
would re-enable UICR writes, but in experiment my UICR writes are still invalid.
How do i disable APPROTECT and re-enable UICR writes?
Thanks!
Best regards.