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

bootloader only enters DFU when using a breakpoint due to watchdog timeout.

We use nRF SDK5 17.0.2 with Softdevice S140 on an nRF52840-DK.

We have a firmware that we always want to start in DFU mode, then use the abort command to be used to start the application.
We use the bootloader with USB from the examples, that we have modified slightly.

I've added:
    sd_power_gpregret_clr(0, 0xffffffff);
    sd_power_gpregret_set(0, 0xb1);
to my application when it starts.

After around five seconds I reset it with NVIC_SystemReset and expect to get back to DFU mode. That doesn't happen, the application starts again.

Setting a breakpoint on nrf_bootloader_wdt_init and hitting continue, it always works as expected.
Setting a breakpoint on loop_forever, I can see the code reaches there, but if I then disable the breakpoint, the bootloader soon resets and starts the application.


I can see wdt_feed_timer_handler is called regularly, but the WDT_IRQHandler gets called.

The reduced_timeout_ticks value is 62336 when nrf_bootloader_wdt_feed_timer_start is called. Changing MAX_FLASH_OP_TIME_TICKS to 20000 doesn't help, I still get watchdog timeouts.

We use these changes in sdk_config.h:

#define NRF_BL_DFU_ENTER_METHOD_BUTTON 0
#define NRF_BL_DFU_INACTIVITY_TIMEOUT_MS 0
#define NRF_DFU_REQUIRE_SIGNED_APP_UPDATE 0
#define NRF_LOG_DEFERRED 0


otherwise the bootloader is like the example.

Is there something else we need to change to get this working?

We also use the watchdog in our application, but I hope that's been cleared after NVIC_SystemReset().

Parents
  • Hi,

    After around five seconds I reset it with NVIC_SystemReset and expect to get back to DFU mode. That doesn't happen, the application starts again.

    I assume you have  NRF_BL_DFU_ENTER_METHOD_GPREGRET set to 1 in sdk_config.h in the bootloader project?

    Could you use the bootloader project with _debug suffix, i.e. pca10056_s140_ble_debug, and check the nrf_log for why it doesn't stay in DFU mode?

    (If you are using SES to view the RTT log you might need to set NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0)

    It should print "DFU mode requested via GPREGRET." in dfu_enter_check() function ...

Reply
  • Hi,

    After around five seconds I reset it with NVIC_SystemReset and expect to get back to DFU mode. That doesn't happen, the application starts again.

    I assume you have  NRF_BL_DFU_ENTER_METHOD_GPREGRET set to 1 in sdk_config.h in the bootloader project?

    Could you use the bootloader project with _debug suffix, i.e. pca10056_s140_ble_debug, and check the nrf_log for why it doesn't stay in DFU mode?

    (If you are using SES to view the RTT log you might need to set NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0)

    It should print "DFU mode requested via GPREGRET." in dfu_enter_check() function ...

Children
No Data
Related