This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52810 bootloader no timeout when OTA fails

Hi,

I'm using nRF52810 on SDKv14.2 and I have changed the bootloader from 52832 to work for 52810. I could do OTA now. I found that the bootloader there is no timeout when OTA fails. So I add a watch dog when DFU start. This way works good for nRF52840, I would close nRF Connect app or close bluetooth to stop doing OTA, when it's timeout, it would run application. But it still works at bootloader mode and wouldn't run to application when when it's timeout for nRF52810.

Add the WDT in the nrf_dfu_init function as follow:

    if (enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid())
{
    scheduler_init();
		
    NRF_WDT->CONFIG         = (WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);       // Configure WDT to run when CPU is asleep
    NRF_WDT->CRV            = 1966079;                                              // Timeout set to 60 seconds, timeout[s] = (CRV+1)/32768
    NRF_WDT->RREN           = WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos;             // Enable the RR[0] reload register
    NRF_WDT->TASKS_START    = 1; }

Then reload the WDTs RR[0] reload register in the nrf_dfu_req_handler_on_req function in the duc_req_handling.c document:

nrf_dfu_res_code_t nrf_dfu_req_handler_on_req(void * p_context, nrf_dfu_req_t * p_req, nrf_dfu_res_t * p_res){

NRF_WDT->RR[0] = WDT_RR_RR_Reload; }

Could anyone hele me have a look? Thanks.

Related