WakeOn RI in SLEEP_NETWORK_STANDBY?

Well that’s cool - it works!

Here’s the code I used on the Electron:

#include "Particle.h"

SerialLogHandler logHandler(LOG_LEVEL_TRACE);

const int SLEEP_PIN = D2;

void setup() {
	Serial.begin();
	pinMode(SLEEP_PIN, INPUT_PULLUP);

}

void loop() {
	if (digitalRead(SLEEP_PIN) == LOW) {
		Log.info("turning on AT+URING=1");

		// Enable wake on all URCs
		Cellular.command("AT+URING=1\r\n");

		delay(1000);

		System.sleep(RI_UC, RISING, 120, SLEEP_NETWORK_STANDBY);

		// This delay is to allow the serial monitor to reconnect only
		delay(2000);

		Log.info("woke from sleep mode");

		// Turn URING back to the default value (only notify on SMS or voice call)
		Cellular.command("AT+URING=0\r\n");
	}
}

I entered sleep by pulling D2 to GND. A few seconds later, the Electron went to sleep.

Then I used the ping feature in the console to ping the Electron, and it woke up and even returned success for the ping.

Log output:

0000222239 [app] INFO: turning on AT+URING=1
   222.239 AT send      12 "AT+URING=1\r\n"
   223.029 AT read OK    6 "\r\nOK\r\n"
0000224029 [comm] INFO: Waiting for Confirmed messages to be sent.
Serial connection closed.  Attempting to reconnect...
Serial monitor opened successfully:
   226.264 AT read  +   17 "\r\n+UUSORD: 0,33\r\n"
Socket 0: handle 0 has 33 bytes pending
   226.274 AT send      17 "AT+USORF=0,1024\r\n"
   226.294 AT read  +   71 "\r\n+USORF: 0,\"52.87.113.144\",5684,33,\"\x17\xfe\xfd\x00\x01\x00\x00\x00\x00\x00 \x00\x14\x00\x01\x00\x00\x00\x00\x00 \xbc\xfa\xa2\xb2\xbc.\xe4'G/\xf2\xf4\""
   226.306 AT read OK    6 "\r\nOK\r\n"
0000226306 [system] TRACE: received 33
0000226306 [comm.coap] TRACE: recieved ACK for message id=12
0000226307 [comm.protocol] INFO: rcv'd message type=13
0000227263 [app] INFO: woke from sleep mode
   227.263 AT send      12 "AT+URING=0\r\n"
   227.264 AT read  +   17 "\r\n+UUSORF: 0,38\r\n"
Socket 0: handle 0 has 38 bytes pending
   227.275 AT read OK    6 "\r\nOK\r\n"
   227.285 AT send      17 "AT+USORF=0,1024\r\n"
   227.305 AT read  +   76 "\r\n+USORF: 0,\"52.87.113.144\",5684,38,\"\x17\xfe\xfd\x00\x01\x00\x00\x00\x00\x00!\x00\x19\x00\x01\x00\x00\x00\x00\x00!\xb4G\x00g5\xb2\x10\xbcD\xd6}\"\xe39o>`\""
   227.317 AT read OK    6 "\r\nOK\r\n"
0000227317 [system] TRACE: received 38
0000227317 [system] TRACE: send 34
socketSendTo(0,52.87.113.144,5684,,34)
   227.318 AT send      36 "AT+USOST=0,\"52.87.113.144\",5684,34\r\n"
   227.329 AT read  >    3 "\r\n@"
   227.379 AT send      34 "\x17\xfe\xfd\x00\x01\x00\x00\x00\x00\x00!\x00\x15\x00\x01\x00\x00\x00\x00\x00!s\xf7\xce\xa7s\xe0\xb8\xd2\xe7\x85\xcd@\x16"
   227.520 AT read  +   16 "\r\n+USOST: 0,34\r\n"
   227.530 AT read OK    6 "\r\nOK\r\n"
3 Likes