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

Enable APP Protection Fails

Hi,

I'm working on enabling APP Protection while successfully executing below code:

if (!nrf_sdh_is_enabled()) {
     if (VERSION_BUILD <= MAX_RELEASE_BUILD) {
         NRF_UICR->APPROTECT = 0xFFFFFF00;
     }
   }

 

Please advise why I'm still able to read out the flash afterwards via the SWD interface.

Best Regards,

Ronny

Parents
  • Are you sure the NRF_UICR->APPROTECT register is being written to with your above code? I think you need to set the NVMC controller in write mode before you can write anything to the UICR registers.

    Maybe try the following:

    /* Turn on flash write enable and wait until the NVMC is ready: */
    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
    
    /* write to the register */
    NRF_UICR->APPROTECT = 0xFFFFFF00;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        
    /* 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){}

Reply Children
No Data
Related