Application watchdog not working with standby mode

I am testing the application watchdog feature, but I can’t seem to get it to work. In the following code, my loop prints “hello world”, then runs for 20 seconds in standby stop mode. For testing, I inserted the watchdog for 10 seconds. What I expected was that the system would be in standby mode for 10 seconds, then the watchdog’s timer would reset it. Instead the electron briefly turns cyan, then goes back to sleeps for 20 seconds (i.e. no watchdog triggered). How can I get the watchdog to trigger even if the electron is in standby mode?

// This #include statement was automatically added by the Particle IDE.
#include <electronsample.h>

#include “AppWatchdogWrapper.h”

AppWatchdogWrapper watchdog(10000); // reset if loop not returned after 10 seconds

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println(“hello world”);
System.sleep(D4,RISING,SLEEP_NETWORK_STANDBY,20); // standby for 20 seconds
}

There are quite some things wrong in that sentence :wink:
You are either using standby or stop mode - these are two mutually exclusive sleep modes.
The device is not running while being in either of these modes. If you tell a runner to stop or standby they are not supposed to carry on running, right? :wink:

Your code is entereing Stop Mode Sleep.

And finally about the Application Watchdog.
This is not a hardware watchdog that can run even when there is no user code running but some software consrutct that needs the device to actually run that code.

So it’s not working in Stop or Standby mode since it’s not meant to.

2 Likes