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

Using the DFU SDK 12.1 with a BLE command to jump to 'bootloader' works every other time with nordic connect app

We have been using the DFU that came with the sdk 12.1 with a modification (essentially removing the button from the DFU code). We currently send an application command that will tell the code to 'jump' to the bootloader. This works great. Once the app command is reeived the device begins advertising 'DFUTarg' I use the nrf connect android app to load the .zip file.

It works the first time, and every odd number time after; hence the second time of jumping back to the bootloader it will appear as if the app was loaded properly and nrf conenct will state the app was successfully loaded but when I scan the device still advertises as DFUTarg. If I try to load again, it will say successfully loaded and will advertise with our custom name.

We have the watchdog timer enabled in the application and following some other posts I added NRF_WDT->RR[0] = WDT_RR_RR_Reload; to the wait_for_event loop in the DFU to pet the dog.

Any suggestions?

Parents
  • Hi Bjorn,

    Thanks for the response, it is set to 0.

    #define SOFTDEVICE_GATTS_SRV_CHANGED   0
    

    but we have

    ble_enable_params.gatts_enable_params.service_changed = 1;
    

    Also we have experimented with increasing the timeout on the WDT and things work fine with these settings:

    #ifndef WDT_CONFIG_BEHAVIOUR
    #define WDT_CONFIG_BEHAVIOUR 0
    #endif
    
    // <o> WDT_CONFIG_RELOAD_VALUE - Reload value  <15-4294967295> 
    
    
    #ifndef WDT_CONFIG_RELOAD_VALUE
    #define WDT_CONFIG_RELOAD_VALUE 5000
    #endif
    

    What we are worried about is if the WDT_VALUE is set to 2000 it works only every other time. We don't want to set the config value to something large as we need the WDT timeout to be shorter for the main application. We aren't sure why the WDT is firing every other time. I added the NRF_WDT->RR[0] = WDT_RR_RR_Reload; in the DFU in the wait_for_event() loop as recommended by this forum...

           NRF_WDT->RR[0] = WDT_RR_RR_Reload; //ADDED
           app_sched_execute();
           NRF_WDT->RR[0] = WDT_RR_RR_Reload; //ADDED
    
Reply
  • Hi Bjorn,

    Thanks for the response, it is set to 0.

    #define SOFTDEVICE_GATTS_SRV_CHANGED   0
    

    but we have

    ble_enable_params.gatts_enable_params.service_changed = 1;
    

    Also we have experimented with increasing the timeout on the WDT and things work fine with these settings:

    #ifndef WDT_CONFIG_BEHAVIOUR
    #define WDT_CONFIG_BEHAVIOUR 0
    #endif
    
    // <o> WDT_CONFIG_RELOAD_VALUE - Reload value  <15-4294967295> 
    
    
    #ifndef WDT_CONFIG_RELOAD_VALUE
    #define WDT_CONFIG_RELOAD_VALUE 5000
    #endif
    

    What we are worried about is if the WDT_VALUE is set to 2000 it works only every other time. We don't want to set the config value to something large as we need the WDT timeout to be shorter for the main application. We aren't sure why the WDT is firing every other time. I added the NRF_WDT->RR[0] = WDT_RR_RR_Reload; in the DFU in the wait_for_event() loop as recommended by this forum...

           NRF_WDT->RR[0] = WDT_RR_RR_Reload; //ADDED
           app_sched_execute();
           NRF_WDT->RR[0] = WDT_RR_RR_Reload; //ADDED
    
Children
No Data
Related