Hi everyone,
I have a couple of M404s with DeviceOS 5.8.0 that will frequently turn on, attempt to connect, and reboot themselves automatically. The measured period between these cycles is around 9 seconds. I need these to not reboot so soon so that other non-connectivity functions can be performed. Eventually after several cycles, the M404 will usually connect, and everything seems to work fine.
The Cellular signal strength is around 15%, and the signal quality fluctuates between 30-75%, but even if there is a poor signal quality, this isn't the behavior I'd like to have.
I previously ran similar code on the B404 and B404X just fine without this issue.
Any idea why this might be happening?
Here's the jist of my code.
#include "Particle.h"
#include // other stuff
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);
SerialLogHandler logHandler(LOG_LEVEL_INFO);
CellularSignal sig;
// instantiate some custom classes
// declare some custom variables
void setup() {
Log.info("Starting setup");
delay(2000ms);
// set GPIO pin modes
// initialize some variables
if(!Particle.connected()) {
Log.info("Connecting to Particle cloud");
Particle.connect();
}
// set up Particle functions
current_time_ms = millis();
}
void loop() {
// update states of various interface inputs (buttons)
// poll sensors
// run actuator loop (actuator will turn on or off based on certain state conditions, should be non-blocking)
//
if (Particle.connected()) {
strcpy(state.vars.cellular_status, "Connected");
} else {
strcpy(state.vars.cellular_status, "Disconnected");
}
sig = Cellular.RSSI();
state.vars.cellular_signal_strength = (double)sig.getStrength();
state.vars.cellular_signal_quality = (double)sig.getQuality();
state.cellular_status_display = state.vars.cellular_status;
if (LOGGING) {
state.tryLog(); // will log output if enough time has gone by based on pre-defined period
}
if (state.tryPublish()) { // will attempt to publish state if enough time has gone by based on pre-defined period
// reset some variables
}
}
I get this output on the serial line when the rebooting happens:
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000006392 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000006395 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000006398 [hal] INFO: DNS server list changed
0000006399 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000006401 [hal] INFO: DNS server list changed
0000006403 [system] INFO: Cloud: connecting
0000006420 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000006443 [system] WARN: Failed to load session data from persistent storage
0000006462 [system] INFO: Discarding session data
0000007203 [system] INFO: Cloud socket=0, connecting to 3.230.254.13#5684
0000007226 [system] INFO: Cloud socket connected
0000007239 [system] INFO: Starting handshake: presense_announce=0
0000007255 [comm.protocol.handshake] INFO: Establish secure
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004063 [app] INFO: open errno: 0
0000004071 [app] INFO: read errno: 0
0000004080 [app] INFO: close errno: 0
0000004090 [app] INFO: open errno: 0
0000004126 [app] INFO: write errno: 0
0000004164 [app] INFO: close errno: 0
0000004554 [app] INFO: Connecting to Particle cloud
0000004565 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004580 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004599 [net.ifapi] INFO: Netif pp3 state UP
0000004622 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004677 [mux] INFO: Starting GSM07.10 muxer
0000004680 [mux] INFO: Opening mux channel 0
0000004681 [mux] INFO: GSM07.10 muxer thread started
0000004683 [mux] INFO: Opening mux channel 1
0000004738 [mux] INFO: Mux channel 1 already opened
0000004769 [mux] INFO: Opening mux channel 2
0000005845 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005848 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005850 [hal] INFO: DNS server list changed
0000005851 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005853 [hal] INFO: DNS server list changed
0000005864 [system] INFO: Cloud: connecting
0000005877 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005899 [system] WARN: Failed to load session data from persistent storage
0000005916 [system] INFO: Discarding session data
0000006488 [system] INFO: Cloud socket=0, connecting to 34.231.252.59#5684
0000006509 [system] INFO: Cloud socket connected
0000006521 [system] INFO: Starting handshake: presense_announce=0
0000006537 [comm.protocol.handshake] INFO: Es
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004072 [app] INFO: open errno: 0
0000004079 [app] INFO: read errno: 0
0000004088 [app] INFO: close errno: 0
0000004098 [app] INFO: open errno: 0
0000004132 [app] INFO: write errno: 0
0000004171 [app] INFO: close errno: 0
0000004562 [app] INFO: Connecting to Particle cloud
0000004577 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004594 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004613 [net.ifapi] INFO: Netif pp3 state UP
0000004630 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004692 [mux] INFO: Starting GSM07.10 muxer
0000004695 [mux] INFO: Opening mux channel 0
0000004696 [mux] INFO: GSM07.10 muxer thread started
0000004699 [mux] INFO: Opening mux channel 1
0000004754 [mux] INFO: Mux channel 1 already opened
0000004785 [mux] INFO: Opening mux channel 2
0000006361 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000006363 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000006365 [hal] INFO: DNS server list changed
0000006367 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000006369 [hal] INFO: DNS server list changed
0000006468 [system] INFO: Cloud: connecting
0000006484 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000006506 [system] WARN: Failed to load session data from persistent storage
0000006523 [system] INFO: Discarding session data
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004062 [app] INFO: open errno: 0
0000004072 [app] INFO: read errno: 0
0000004081 [app] INFO: close errno: 0
0000004091 [app] INFO: open errno: 0
0000004124 [app] INFO: write errno: 0
0000004161 [app] INFO: close errno: 0
0000004551 [app] INFO: Connecting to Particle cloud
0000004566 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004584 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004603 [net.ifapi] INFO: Netif pp3 state UP
0000004621 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004682 [mux] INFO: Starting GSM07.10 muxer
0000004685 [mux] INFO: Opening mux channel 0
0000004685 [mux] INFO: GSM07.10 muxer thread started
0000004689 [mux] INFO: Opening mux channel 1
0000004743 [mux] INFO: Mux channel 1 already opened
0000004773 [mux] INFO: Opening mux channel 2
0000005848 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005850 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005852 [hal] INFO: DNS server list changed
0000005854 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005856 [hal] INFO: DNS server list changed
0000005955 [system] INFO: Cloud: connecting
0000005970 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005994 [system] WARN: Failed to load session data from persistent storage
0000006011 [system] INFO: Discarding session data
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004062 [app] INFO: open errno: 0
0000004071 [app] INFO: read errno: 0
0000004080 [app] INFO: close errno: 0
0000004090 [app] INFO: open errno: 0
0000004125 [app] INFO: write errno: 0
0000004163 [app] INFO: close errno: 0
0000004554 [app] INFO: Connecting to Particle cloud
0000004569 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004586 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004605 [net.ifapi] INFO: Netif pp3 state UP
0000004620 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004684 [mux] INFO: Starting GSM07.10 muxer
0000004687 [mux] INFO: Opening mux channel 0
0000004687 [mux] INFO: GSM07.10 muxer thread started
0000004690 [mux] INFO: Opening mux channel 1
0000004744 [mux] INFO: Mux channel 1 already opened
0000004774 [mux] INFO: Opening mux channel 2
0000005849 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005851 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005854 [hal] INFO: DNS server list changed
0000005855 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005857 [hal] INFO: DNS server list changed
0000005859 [system] INFO: Cloud: connecting
0000005874 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005897 [system] WARN: Failed to load session data from persistent storage
0000005917 [system] INFO: Discarding session data
0000006478 [system] INFO: Cloud socket=0, connecting to 3.230.254.13#5684
0000006500 [system] INFO: Cloud socket connected
0000006510 [system] INFO: Starting handshake: presense_announce=0
0000006527 [comm.protocol.handshake] INFO: Establish secure connection
0000006551 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000011458 [comm.protocol.handshake] INFO: Sending HELLO message
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004071 [app] INFO: open errno: 0
0000004080 [app] INFO: read errno: 0
0000004089 [app] INFO: close errno: 0
0000004099 [app] INFO: open errno: 0
0000004132 [app] INFO: write errno: 0
0000004171 [app] INFO: close errno: 0
0000004563 [app] INFO: Connecting to Particle cloud
0000004578 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004590 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004610 [net.ifapi] INFO: Netif pp3 state UP
0000004620 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004685 [mux] INFO: Starting GSM07.10 muxer
0000004687 [mux] INFO: Opening mux channel 0
0000004688 [mux] INFO: GSM07.10 muxer thread started
0000004691 [mux] INFO: Opening mux channel 1
0000004745 [mux] INFO: Mux channel 1 already opened
0000004775 [mux] INFO: Opening mux channel 2
0000005850 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005853 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005855 [hal] INFO: DNS server list changed
0000005857 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005859 [hal] INFO: DNS server list changed
0000005861 [system] INFO: Cloud: connecting
0000005878 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005898 [system] WARN: Failed to load session data from persistent storage
0000005917 [system] INFO: Discarding session data
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004058 [app] INFO: open errno: 0
0000004068 [app] INFO: read errno: 0
0000004077 [app] INFO: close errno: 0
0000004087 [app] INFO: open errno: 0
0000004122 [app] INFO: write errno: 0
0000004160 [app] INFO: close errno: 0
0000004551 [app] INFO: Connecting to Particle cloud
0000004566 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004584 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004603 [net.ifapi] INFO: Netif pp3 state UP
0000004619 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004682 [mux] INFO: Starting GSM07.10 muxer
0000004685 [mux] INFO: Opening mux channel 0
0000004686 [mux] INFO: GSM07.10 muxer thread started
0000004688 [mux] INFO: Opening mux channel 1
0000004743 [mux] INFO: Mux channel 1 already opened
0000004773 [mux] INFO: Opening mux channel 2
0000005849 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005852 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005854 [hal] INFO: DNS server list changed
0000005855 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005858 [hal] INFO: DNS server list changed
0000005963 [system] INFO: Cloud: connecting
0000005977 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005999 [system] WARN: Failed to load session data from persistent storage
0000006018 [system] INFO: Discarding session data
0000006393 [system] INFO: Cloud socket=0, connecting to 34.231.252.59#5684
0000006412 [system] INFO: Cloud socket connected
0000006424 [system] INFO: Starting handshake: presense_announce=0
0000006440 [comm.protocol.handshake] INFO: Establish secure connection
0000006461 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004074 [app] INFO: open errno: 0
0000004083 [app] INFO: read errno: 0
0000004092 [app] INFO: close errno: 0
0000004102 [app] INFO: open errno: 0
0000004134 [app] INFO: write errno: 0
0000004172 [app] INFO: close errno: 0
0000004564 [app] INFO: Connecting to Particle cloud
0000004579 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004596 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004615 [net.ifapi] INFO: Netif pp3 state UP
0000004619 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004687 [mux] INFO: Starting GSM07.10 muxer
0000004690 [mux] INFO: Opening mux channel 0
0000004690 [mux] INFO: GSM07.10 muxer thread started
0000004695 [mux] INFO: Opening mux channel 1
0000004749 [mux] INFO: Mux channel 1 already opened
0000004781 [mux] INFO: Opening mux channel 2
0000005856 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005858 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005860 [hal] INFO: DNS server list changed
0000005862 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005864 [hal] INFO: DNS server list changed
0000005866 [system] INFO: Cloud: connecting
0000005885 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005907 [system] WARN: Failed to load session data from persistent storage
0000005926 [system] INFO: Discarding session data
0000006308 [system] INFO: Cloud socket=0, connecting to 34.231.252.59#5684
0000006327 [system] INFO: Cloud socket connected
0000006338 [system] INFO: Starting handshake: presense_announce=0
0000006354 [comm.protocol.handshake] INFO: Establish secure connection
0000006362 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
The M404 seems to reboot part way though these printouts.
Finally, when it does connect I get this:
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004069 [app] INFO: open errno: 0
0000004074 [app] INFO: read errno: 0
0000004083 [app] INFO: close errno: 0
0000004093 [app] INFO: open errno: 0
0000004127 [app] INFO: write errno: 0
0000004161 [app] INFO: close errno: 0
0000004552 [app] INFO: Connecting to Particle cloud
0000004564 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000004580 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000004598 [net.ifapi] INFO: Netif pp3 state UP
0000004614 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000004677 [mux] INFO: Starting GSM07.10 muxer
0000004680 [mux] INFO: Opening mux channel 0
0000004681 [mux] INFO: GSM07.10 muxer thread started
0000004683 [mux] INFO: Opening mux channel 1
0000004737 [mux] INFO: Mux channel 1 already opened
0000004767 [mux] INFO: Opening mux channel 2
0000005846 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000005849 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000005851 [hal] INFO: DNS server list changed
0000005852 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000005855 [hal] INFO: DNS server list changed
0000005857 [system] INFO: Cloud: connecting
0000005871 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000005893 [system] WARN: Failed to load session data from persistent storage
0000005912 [system] INFO: Discarding session data
0000006826 [system] INFO: Cloud socket=0, connecting to 34.231.252.59#5684
0000006850 [system] INFO: Cloud socket connected
0000006864 [system] INFO: Starting handshake: presense_announce=0
0000006880 [comm.protocol.handshake] INFO: Establish secure connection
0000006901 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000011722 [comm.protocol.handshake] INFO: Sending HELLO message
0000011866 [comm.protocol.handshake] INFO: Handshake completed
0000011883 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000011900 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000013221 [system] INFO: Send spark/device/last_reset event
0000013250 [comm] INFO: Sending TIME request
0000013264 [system] INFO: Sending application DESCRIBE
0000013302 [system] INFO: Sending subscriptions
0000013312 [comm.protocol] INFO: Sending subscriptions
0000013680 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
After this, the expected logging printouts appear, and things seem to be fine.