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

buttonless DFU. memory protection from read in nrf52810

Hello!

Can I enable memory protection for reading (using nrfjprog --rbp ALL) if I use write to internal memory through buttonless DFU and fstorage_sd?

Parents
  • Hello,

    It's possible to enable this setting at runtime, but you need to do it before enabling the Softdevice as the softdevice flash API will not let you write data to the UICR section. You can use the same approach that we use to enable the reset pin. 

    E.g., 

    /*Must be called before enabling the Softdevice*/
    void enable_rbp(void)
    {
        if ((NRF_UICR->APPROTECT != UICR_APPROTECT_PALL_Enabled))
        {
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_UICR->APPROTECT = UICR_APPROTECT_PALL_Enabled;
            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){}
            NVIC_SystemReset();
        }
    }

Reply Children
No Data
Related