Hi
On the nRF52840-QIAA-R there should be implemented the APPROTECT according to this guide:
Informational Notice (IN) - Vulnerability of the nRF52 series.
I implemented now the suggested code on top of main:
void AppProtection(void)
{
#ifdef ENABLE_APPROTECT
if ((NRF_UICR->APPROTECT & UICR_APPROTECT_PALL_Msk) !=
(UICR_APPROTECT_PALL_Enabled << UICR_APPROTECT_PALL_Pos)) {
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->APPROTECT = ((NRF_UICR->APPROTECT & ~((uint32_t)UICR_APPROTECT_PALL_Msk)) |
(UICR_APPROTECT_PALL_Enabled << UICR_APPROTECT_PALL_Pos));
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NVIC_SystemReset();
}
#else
if ((NRF_UICR->APPROTECT & UICR_APPROTECT_PALL_Msk) !=
(UICR_APPROTECT_PALL_HwDisabled << UICR_APPROTECT_PALL_Pos)) {
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->APPROTECT = ((NRF_UICR->APPROTECT & ~((uint32_t)UICR_APPROTECT_PALL_Msk)) |
(UICR_APPROTECT_PALL_HwDisabled << UICR_APPROTECT_PALL_Pos));
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NVIC_SystemReset();
}
#endif
}
This is working, but the problem is that the verify in production programming is not working anymore. Is there an option to verify the chip before? Because after a program the chip is getting restarted and read out protection is active which makes verify impossible. Is there a solution to verify with nrfjprog or use nrfjprog to program without starting the code on the nRF52?
nrfjprog --program %HEX_FILE% --verify --log