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().