Questions on ERASEALL and UICR registers.

Hello,   

I got several questions below:

1. Once the CTRL_AP setup was already configured below, even if NVMC.ERASEALL is set  , does that mean UICR registers (NRF_UICR->APPROTECT,  and etc) can't be changed anymore?

/* Prevent from unlocking APPROTECT after this point. */
NRF_CTRLAP_S->APPROTECT.LOCK = 0;
/* Prevent from unlocking SECURE APPROTECT after this point. */
NRF_CTRLAP_S->SECUREAPPROTECT.LOCK = 0;

/* This will not disable APPROTECT and SECUREAPPROTECT, and so
* not enable debug access to either non-secure or secure mode.
*/
NRF_CTRLAP_S->APPROTECT.DISABLE = 0;
NRF_CTRLAP_S->SECUREAPPROTECT.DISABLE = 0;

/* Prevent from locking APPROTECT after this point. */
NRF_CTRLAP_S->APPROTECT.LOCK = 1;
/* Prevent from locking SECURE APPROTECT after this point. */
NRF_CTRLAP_S->SECUREAPPROTECT.LOCK = 1;
2.  The above CTRL_AP setup should run every boot?  Or, can it be set one time until "--recover" command?
  • Hi Jaewook,

    Thankyou for contacting DevZone at NordicSemi.

    To enable port protection access for both secure and non-secure modes, we use registers UICR.SECUREAPPROTECT and UICR.APPROTECT, as well as CTRLAP.APPROTECT.DISABLE and CTRLAP.SECUREAPPROTECT.DISABLE; that is what you are doing.

    Erase protection (ERASEPROTECT) protects the flash and UICR parts of the non-volatile memory from being erased. Erase protection can be temporarily disabled from the control access port.

    1) So yes, as per your case description, contents of UICR will not be changed.
    2) Yes, such a setup should run every boot as it is app level.

    In fact you can setup your project to see as you have described and observe value and status of registers.

    Thanks,
    Naeem

Related