I’m using a B402 with device OS 2.2.0 with semi-automatic and threading enabled.
Below is a code snippet in which I use to disconnect from the cellular before going to sleep.
I’ve been having problems with turning the cellular off. In some cases, I receive a “failed to power off modem” error which basically bricks the device. Power cycling it fixes it, but obviously this isn’t a solution when this device is out in the field.
Particle.disconnect();
waitUntil(Particle.disconnected);
Log.info("particle disconnected\n");
Cellular.disconnect();
waitUntilNot(Cellular.ready);
Log.info("Cellular disconnected\n");
Cellular.off();
waitFor(Cellular.isOff, 30000);
Log.info("Cellular off\n");
Essentially, I’d like to know the best way to turn off cellular before going to sleep.
In this post, it is suggested to let the DeviceOS handle shutting down the modem, in which there is no need to call Cellular.off(), etc., and just call sleep. Is this applicable to the B402, as the advice in that thread was for an e-series?
If it helps, here are the logs of when I receive the error.
I’ve noticed that whenever I receive the below message after disconnecting, what follows is the “failed to power off modem” messages.
ERROR: The other end has not replied to keep alives (TESTs) 5 times, considering muxed connection dead
0000910758 [app] INFO: particle disconnected
0000910758 [net.pppncp] TRACE: PPP netif event from queue: 2
0000910759 [net.ppp.client] TRACE: PPP thread event LOWER_DOWN
0000910759 [net.ppp.client] TRACE: State CONNECTED -> DISCONNECT
0000910760 [net.ppp.client] TRACE: State DISCONNECT -> DISCONNECTING
0000910761 [ncp.at] TRACE: > AT+CFUN=0,0
0000910762 [system.nm] INFO: State changed: IP_CONFIGURED -> IFACE_UP
0000910762 [net.ppp.client] TRACE: PPP phase -> 9
0000910763 [net.ppp.client] TRACE: PPP phase -> 6
0000910763 [net.ppp.client] TRACE: PPP phase -> 12
0000910764 [net.ppp.client] TRACE: PPP phase -> 0
0000910764 [net.ppp.client] TRACE: PPP thread event ADM_DOWN
0000910764 [net.ppp.client] TRACE: PPP thread event DOWN
0000910765 [net.ppp.client] TRACE: State DISCONNECTING -> DISCONNECTED
0000910765 [net.ppp.client] TRACE: State DISCONNECTED -> NONE
0000910766 [system.nm] INFO: State changed: IFACE_UP -> IFACE_REQUEST_DOWN
0000910767 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0000910766 [app] INFO: network_event:6
0000910768 [app] INFO: Cellular disconnected
0000910768 [app] INFO: network_event:10
0000910769 [app] INFO: network_event:11
0000910769 [system.nm] TRACE: Request to power off the interface
0000910770 [system.nm] TRACE: Interface 4 power state: 2
0000910771 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
0000910772 [app] INFO: network_event:2
0000928053 [gsm0710muxer] ERROR: The other end has not replied to keep alives (TESTs) 5 times, considering muxed connection dead
0000928054 [ncp.client] TRACE: NCP connection state changed: 1
0000928054 [net.pppncp] TRACE: NCP event 2
0000928054 [net.pppncp] TRACE: State changed event: 1
0000928055 [net.ppp.client] TRACE: PPP thread event LOWER_DOWN
0000928056 [net.pppncp] TRACE: NCP event 3
0000928056 [net.pppncp] TRACE: NCP power state changed: IF_POWER_STATE_POWERING_DOWN
0000928056 [gsm0710muxer] INFO: GSM07.10 muxer thread exiting
0000928057 [system.nm] TRACE: Interface 4 power state changed: 3
0000928058 [ncp.client] TRACE: Try powering modem off using AT command
0000928059 [gsm0710muxer] INFO: Stopping GSM07.10 muxer
0000928059 [gsm0710muxer] INFO: GSM07.10 muxer stopped
0000928060 [ncp.client] TRACE: Setting UART voltage translator state 0
0000928060 [ncp.client] TRACE: Powering modem off using hardware control
0000928061 [ncp.client] TRACE: Setting UART voltage translator state 0
0000939661 [ncp.client] ERROR: Failed to power off modem
0000939661 [ncp.client] TRACE: Deinit modem serial.
0000939662 [ncp.client] TRACE: Try powering modem off using AT command
0000939662 [ncp.client] ERROR: NCP client is not ready
0000939663 [ncp.client] TRACE: Setting UART voltage translator state 0
0000939664 [ncp.client] TRACE: Powering modem off using hardware control
0000939664 [ncp.client] TRACE: Setting UART voltage translator state 0
0000940768 [app] INFO: Cellular off
0000940768 [app] INFO: sleepDelay==241
0000940768 [system.sleep] TRACE: Entering system_sleep_ext()
0000940769 [system.nm] TRACE: Request to power off the interface
0000940769 [system.sleep] TRACE: Waiting interface 4 to be off...
0000951264 [ncp.client] ERROR: Failed to power off modem
0000951264 [ncp.client] TRACE: Deinit modem serial.
0000951265 [ncp.client] TRACE: NCP connection state changed: 0
0000951265 [net.pppncp] TRACE: NCP event 2
0000951265 [net.pppncp] TRACE: State changed event: 0
0000951266 [net.ppp.client] TRACE: PPP thread event LOWER_DOWN
0000951266 [ncp.client] TRACE: NCP state changed: 0
0000951267 [net.pppncp] TRACE: NCP event 1
0000951267 [net.pppncp] TRACE: PPP netif event from queue: 4
0000951268 [ncp.client] TRACE: Try powering modem off using AT command
0000951268 [ncp.client] ERROR: NCP client is not ready
0000951269 [ncp.client] TRACE: Setting UART voltage translator state 0
0000951269 [ncp.client] TRACE: Powering modem off using hardware control
0000951270 [ncp.client] TRACE: Setting UART voltage translator state 0
0000962870 [ncp.client] ERROR: Failed to power off modem
I appreciate the help.