I'm building a small firmware to explore different types of sleep on the Boron. However, I've started having problems with my device including struggles to connect to the cloud, go to sleep or wake up from sleep.
I followed the cellular trouble guide - ensuring my LiPo battery is connected, I'm running 6.1.1 software, the antenna is firmly connected. But my device still doesn't wake up
I then ran the device doctor and got what look like normal results, including ability to connect with cellular networks.
I am now running a basic sleep program:
// Include Particle Device OS APIs
#include "Particle.h"
SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler(LOG_LEVEL_INFO);
SystemSleepConfiguration sleepConfig;
String getTimestamp();
void setup() {
Serial.begin(9600);
delay(100);
waitFor(Serial.isConnected, 30000);
// Wait for cellular connection
Cellular.on();
Cellular.connect();
waitFor(Cellular.ready, 180000);
// Synchronize time with the Particle Cloud
Particle.connect();
waitFor(Particle.connected, 30000);
Particle.syncTime();
waitFor(Particle.syncTimeDone,30000);
Time.zone(-2); // Set your time zone (e.g., -5 for Eastern Time)
//Prepare Sleep
sleepConfig.mode(SystemSleepMode::ULTRA_LOW_POWER) //Default
.duration(1min);
delay(100);
Serial.printlnf("%s Set up v4 complete", getTimestamp().c_str());
}
void loop() {
Serial.printlnf("%s Loop start", getTimestamp().c_str());
delay(100);
Serial.printlnf("%s Going to sleep for 1 min", getTimestamp().c_str());
delay(100);
System.sleep(sleepConfig);
Serial.printlnf("%s Waking up", getTimestamp().c_str());
}
String getTimestamp() {
time_t currentTime = Time.now();
// Manually adjust the timestamp by subtracting 5 hours (18000 seconds)
currentTime -= 18000;
char timestamp[9];
strftime(timestamp, sizeof(timestamp), "%H:%M:%S", localtime(¤tTime));
return String(timestamp);
}
When I run this code, the device goes to sleep, but generates three errors when it attempts to wake: "Failed to enter data mode", "Failed to dial", "ppp error event data=5"
Here are logs showing proper entry to sleep and two failed wake attempts:
**Serial connection closed. Attempting to reconnect...**
**Serial monitor opened successfully:**
0000001332 [mux] INFO: Stopping GSM07.10 muxer
0000001332 [mux] INFO: Gracefully stopping GSM07.10 muxer
0000001333 [mux] INFO: Closing all muxed channels
0000001333 [mux] INFO: Muxed channel 1 already closed
0000001333 [mux] INFO: Muxed channel 2 already closed
0000001334 [mux] INFO: Muxed channel 3 already closed
0000001334 [mux] INFO: Muxed channel 4 already closed
0000001335 [mux] INFO: Sending CLD (multiplexer close down)
0000002235 [mux] INFO: Received response to CLD or timed out, exiting multiplexed mode
0000002285 [mux] INFO: GSM07.10 muxer thread exiting
0000002285 [mux] INFO: GSM07.10 muxer stopped
0000002301 [ncp.client] INFO: Using internal SIM card
0000003387 [mux] INFO: Starting GSM07.10 muxer
0000003388 [mux] INFO: Opening mux channel 0
0000003388 [mux] INFO: GSM07.10 muxer thread started
0000003395 [mux] INFO: Opening mux channel 1
0000005157 [mux] INFO: Opening mux channel 2
0000007455 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000007457 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000007459 [system] INFO: Cloud: connecting
0000007461 [system] INFO: Cloud socket connected
0000007461 [comm.protocol.handshake] INFO: Establish secure connection
0000007464 [comm.dtls] INFO: session has 0 uses
0000007473 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000007474 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,0,23, next_coap_id=13
0000007474 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=19
0000007475 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000007730 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000007730 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000007731 [comm.protocol.handshake] INFO: Sending HELLO message
0000007842 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000007843 [comm.protocol.handshake] INFO: Handshake completed
0000007843 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000007844 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000008242 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000008689 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000008990 [comm.protocol] INFO: Received TIME response: 1737569393
0000009095 [system] INFO: Cloud connected
0000009294 [comm.protocol] INFO: Received TIME response: 1737569394
13:09:54 Set up v4 complete
13:09:54 Loop start
0000009397 [comm.protocol] INFO: Sending subscriptions
13:09:54 Going to sleep for 1 min
0000009503 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000009504 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000009545 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000009546 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000009598 [system] INFO: Cloud: disconnecting
0000009598 [system] INFO: Cloud: disconnected
0000009599 [system.nm] INFO: State changed: IP_CONFIGURED -> IFACE_LINK_UP
0000009605 [system.nm] INFO: State changed: IFACE_LINK_UP -> IFACE_UP
0000009606 [net.pppncp] ERROR: PPP error event data=5
0000009610 [system.nm] INFO: State changed: IFACE_UP -> IFACE_REQUEST_DOWN
0000009610 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0000009611 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
0000018333 [mux] INFO: Stopping GSM07.10 muxer
0000018333 [mux] INFO: Gracefully stopping GSM07.10 muxer
0000018334 [mux] INFO: Closing all muxed channels
0000018334 [mux] INFO: Closing mux channel 1
0000018335 [mux] INFO: Closing mux channel 2
0000018335 [mux] INFO: Muxed channel 3 already closed
0000018335 [mux] INFO: Muxed channel 4 already closed
0000018336 [mux] INFO: GSM07.10 muxer thread exiting
0000018337 [mux] INFO: GSM07.10 muxer stopped
**Serial connection closed. Attempting to reconnect...**
**Serial monitor opened successfully:**
0000098128 [net.pppncp] ERROR: PPP error event data=5
0000102164 [system.nm] INFO: State changed: IFACE_UP -> IFACE_REQUEST_DOWN
0000107164 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0000108469 [mux] INFO: Stopping GSM07.10 muxer
0000108469 [mux] INFO: Gracefully stopping GSM07.10 muxer
0000108469 [mux] INFO: Closing all muxed channels
0000108470 [mux] INFO: Closing mux channel 1
0000108470 [mux] INFO: Closing mux channel 2
0000108471 [mux] INFO: Muxed channel 3 already closed
0000108471 [mux] INFO: Muxed channel 4 already closed
0000108472 [mux] INFO: GSM07.10 muxer thread exiting
0000108472 [mux] INFO: GSM07.10 muxer stopped
0000112165 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
**Serial connection closed. Attempting to reconnect...**
**Serial monitor opened successfully:**
0000199803 [ncp.client] ERROR: Failed to enter data mode
0000199804 [net.ppp.client] ERROR: Failed to dial
0000199809 [net.pppncp] ERROR: PPP error event data=5
0000200925 [mux] INFO: Stopping GSM07.10 muxer
0000200925 [mux] INFO: Gracefully stopping GSM07.10 muxer
0000200926 [mux] INFO: Closing all muxed channels
0000200926 [mux] INFO: Closing mux channel 1
0000200926 [mux] INFO: Closing mux channel 2
0000200927 [mux] INFO: Muxed channel 3 already closed
0000200927 [mux] INFO: Muxed channel 4 already closed
0000200928 [mux] INFO: GSM07.10 muxer thread exiting
0000200928 [mux] INFO: GSM07.10 muxer stopped
0000200929 [net.pppncp] ERROR: Failed to initialize cellular NCP client: -210
0000202971 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0000204100 [ncp.client] INFO: Using internal SIM card
0000206573 [mux] INFO: Starting GSM07.10 muxer
0000206574 [mux] INFO: Opening mux channel 0
0000206574 [mux] INFO: GSM07.10 muxer thread started
0000206577 [mux] INFO: Opening mux channel 1
0000207971 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
0000214552 [mux] INFO: Stopping GSM07.10 muxer
0000214552 [mux] INFO: Gracefully stopping GSM07.10 muxer
0000214553 [mux] INFO: Closing all muxed channels
0000214553 [mux] INFO: Closing mux channel 1
0000214553 [mux] INFO: Muxed channel 2 already closed
0000214554 [mux] INFO: Muxed channel 3 already closed
0000214554 [mux] INFO: Muxed channel 4 already closed
0000214555 [mux] INFO: GSM07.10 muxer thread exiting
0000214556 [mux] INFO: GSM07.10 muxer stopped