Watchdog - Hardware
Sleep considerations
On all platforms, the default is for the watchdog to continue running during sleep mode.
On the Boron, B-Series SoM, Tracker, Argon, and E404X (nRF52840), the WatchdogCap::SLEEP_RUNNING
defaults to on, which is to say the watchdog continues to run while in sleep. It can, however, be explictly cleared so the watchdog will be paused while in sleep mode.
On the P2 and Photon 2 (RTL872x), the watchdog contiues to run in sleep mode. However, you could manually stop it before sleep mode.
For best compatibility across devices, we recommend that you set a watchdog timeout longer than your sleep period, plus an allowance for the time it takes to go to sleep, and wake up from sleep, which could add 30 seconds to a minute. This also provides extra safety in case the device does not wake up at the expected time, as the watchdog will reset the system in this case. This could happen if you have a bug in your logic for how long to sleep, for example.
Watchdog capabilities
// Getting capabiltiies
WatchdogInfo info;
Watchdog.getInfo(info);
// Get the capabilities that are always enabled
WatchdogCaps mandatoryCaps = info.mandatoryCapabilities();
// Get the capabilities that can be turned off
WatchdogCaps optionalCaps = info.capabilities();
The capabilities vary depending on the platform:
Capability | nRF52 | RTL872x | Details |
---|---|---|---|
WatchdogCap::RESET |
Mandatory | Default | Reset device on watchdog timeout expired |
WatchdogCap::NOTIFY |
Optional | Generate an interrupt on expired | |
WatchdogCap::NOTIFY_ONLY |
Optional | Generate an interrupt on expired without resetting the device | |
WatchdogCap::RECONFIGURABLE |
Optional | Can be re-configured after started | |
WatchdogCap::STOPPABLE |
Optional | Can be stopped after started | |
WatchdogCap::SLEEP_RUNNING |
Default | 1 | Watchdog runs while in sleep mode |
WatchdogCap::DEBUG_RUNNING |
Optional | Mandatory | Can be paused in debug mode |
Minimim Timeout | 1 | 1 | |
Maximum Timeout | 131071 s | 8190 s |
1On the RTL872x platform, the watchdog cannot be automatically stopped in sleep mode.