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

Buttonless Secure DFU with WDT needs DFU twice

I use nrf51822xxAC,SDK 12.2,Buttonless Secure DFU and WDT in application.

I added NRF_WDT->RR[0] = WDT_RR_RR_Reload; to the wait_for_event loop in the DFU to pet the dog.

But it needs to DFU twice to let the chip run into application.

The same question in this link.

Could anyone help me?

Parents
  • Hi Kamisen,

    I'm sorry indeed for late response. I was occupied by something else and forgot to get back to the case.

    I checked again, it seems that if we only put the NRF_WDT->RR[0] = WDT_RR_RR_Reload; inside wait_for_event() it's not enough as after we receive the image and then do swapping it may last longer than 2 seconds ( i tried 10seconds and it worked) and cause a WDT reset. What you can do is to put the NRF_WDT->RR[0] = WDT_RR_RR_Reload; also inside the while loop in nrf_dfu_app_continue() in nrf_dfu_utils.c like this:

    NRF_LOG_INFO("Enter nrf_dfu_app_continue\r\n");
    
        // Copy the application down safely
        do
        {   NRF_WDT->RR[0] = WDT_RR_RR_Reload;
    
            cur_len = (length_left > split_size) ? split_size : length_left;
    

    Please try and let me know if it fix the issue for you.

Reply
  • Hi Kamisen,

    I'm sorry indeed for late response. I was occupied by something else and forgot to get back to the case.

    I checked again, it seems that if we only put the NRF_WDT->RR[0] = WDT_RR_RR_Reload; inside wait_for_event() it's not enough as after we receive the image and then do swapping it may last longer than 2 seconds ( i tried 10seconds and it worked) and cause a WDT reset. What you can do is to put the NRF_WDT->RR[0] = WDT_RR_RR_Reload; also inside the while loop in nrf_dfu_app_continue() in nrf_dfu_utils.c like this:

    NRF_LOG_INFO("Enter nrf_dfu_app_continue\r\n");
    
        // Copy the application down safely
        do
        {   NRF_WDT->RR[0] = WDT_RR_RR_Reload;
    
            cur_len = (length_left > split_size) ? split_size : length_left;
    

    Please try and let me know if it fix the issue for you.

Children
Related