Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Watchdog and sd_app_evt_wait()

Hi,

I have an issue with the watchdog and sd_app_evt_wait() when running the softdevice.
It seems impossible to not let the watchdog go off while having an idle ble connection!
When the timeout is set to 1s and the connection interval at 7.5ms (min), the watchdog goes off and resets the system after +-45s when there is no activity and so sd_app_evt_wait() does not return.
When the timeout is 4s, the watchdog goes off after +-180s. But I cannot guarantee there is "activity" every 180s from the user's phone.

This can be easily reproduced by adding nrf_drv_wdt_init(), nrf_drv_wdt_channel_alloc() and nrf_drv_wdt_enable() to the ble_app_blinky peripheral example and setting  MIN_CONN_INTERVAL to MSEC_TO_UNITS(7.5, UNIT_1_25_MS). Add nrf_drv_wdt_feed() before every call to sd_app_evt_wait() (in power_manage()).
In sdk_config.h: WDT_CONFIG_BEHAVIOUR=0 (pause in sleep and halt), WDT_CONFIG_RELOAD_VALUE=1000 and WDT_ENABLED=1.
After making a connection with nRF Connect (with connection interval 7.5ms) just wait 45s and the watchdog will reset the device!

Is it possible to get some events from the softdevice where I can feed the watchdog, or to configure the softdevice to feed the watchdog ?
The only solution I see would be to add a timer of eg 40s that will feed the watchdog (not from the timer isr context!). But how can I guarantee that this 40s is fast enough ?

A simular question has been raised +2 years ago without a proper answer: watchdog-while-in-sd_app_evt_wait.

I'm using nRF52832 with SDK: 14.0.0 and SD:s132_nrf52_5.0.0

Kind regards,
Marten

Related