I am noticing that is takes a long time for my Boron (deviceOS@2.1.0) to go to sleep. When I looked at the logs, it seems that the device is powering down the cellular modem each time it enters sleep. This is despite the fact that the device is off-line and the cellular modem had previously been powered down.
Here is what I am seeing from the serial logger:
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000537654 [ncp.at] TRACE: > AT
0000537807 [app] INFO: From Idle to Napping
0000537807 [app.ab1805] INFO: setWDT 0
0000537808 [app.ab1805] TRACE: watchdog cleared bResult=1
0000537808 [system.sleep] TRACE: Entering system_sleep_ext()
0000537809 [system.nm] TRACE: Request to power off the interface
0000537810 [system.nm] TRACE: Interface 4 power state: 2
0000537811 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
0000537811 [system.sleep] TRACE: Waiting interface 4 to be off...
0000538654 [ncp.at] TRACE: > AT
0000539654 [ncp.at] TRACE: > AT
0000540654 [ncp.at] TRACE: > AT
0000540696 [ncp.at] TRACE: < OK
0000540696 [ncp.client] TRACE: NCP ready to accept AT commands
0000540697 [ncp.at] TRACE: > ATI9
0000540699 [ncp.at] TRACE: < L0.0.00.00.05.08,A.02.04
0000540699 [ncp.at] TRACE: < OK
0000540700 [ncp.client] TRACE: App firmware: 204
0000540700 [ncp.at] TRACE: > AT+UGPIOC?
0000540702 [ncp.at] TRACE: < +UGPIOC:
0000540702 [ncp.at] TRACE: < 7,255
0000540703 [ncp.at] TRACE: < 16,255
0000540703 [ncp.at] TRACE: < 19,255
0000540704 [ncp.at] TRACE: < 23,0
0000540704 [ncp.at] TRACE: < 24,255
0000540705 [ncp.at] TRACE: < 25,255
0000540705 [ncp.at] TRACE: < 42,255
0000540706 [ncp.at] TRACE: < OK
0000540706 [ncp.at] TRACE: > AT+UGPIOR=23
0000540709 [ncp.at] TRACE: < +UGPIOR: 23,1
0000540709 [ncp.at] TRACE: < OK
0000540709 [ncp.client] INFO: Using internal SIM card
0000540710 [ncp.at] TRACE: > AT+CPIN?
0000540713 [ncp.at] TRACE: < +CME ERROR: SIM not inserted
0000541713 [ncp.at] TRACE: > AT+CPIN?
0000545518 [ncp.at] TRACE: < +CPIN: READY
0000545518 [ncp.at] TRACE: < OK
0000545518 [ncp.at] TRACE: > AT+CCID
0000545521 [ncp.at] TRACE: < +CCID: 89014103273166774681
0000545521 [ncp.at] TRACE: < OK
0000545522 [ncp.at] TRACE: > AT+CFUN=0,0
0000545735 [ncp.at] TRACE: < OK
0000545735 [ncp.at] TRACE: > AT+CFUN=1,0
0000545738 [ncp.at] TRACE: < OK
0000545738 [ncp.at] TRACE: > AT+CCID
0000545741 [ncp.at] TRACE: < +CCID: 89014103273166774681
0000545741 [ncp.at] TRACE: < OK
0000545742 [ncp.at] TRACE: > AT+CIMI
0000545744 [ncp.at] TRACE: < 310410316677468
0000545744 [ncp.at] TRACE: < OK
0000545745 [ncp.at] TRACE: > AT+UMNOPROF?
0000545750 [ncp.at] TRACE: < +UMNOPROF: 2
0000545751 [ncp.at] TRACE: < OK
0000545751 [ncp.at] TRACE: > AT+IFC=2,2
0000545754 [ncp.at] TRACE: < OK
0000545754 [ncp.at] TRACE: > AT
0000545756 [ncp.at] TRACE: < OK
0000545756 [ncp.at] TRACE: > AT+COPS=3,2
0000545759 [ncp.at] TRACE: < OK
0000545759 [ncp.at] TRACE: > AT+CGEREP=1,0
0000545762 [ncp.at] TRACE: < OK
0000545762 [ncp.at] TRACE: > AT+IPR=460800
0000545769 [ncp.at] TRACE: < OK
0000546769 [ncp.at] TRACE: > AT
0000546772 [ncp.at] TRACE: < OK
0000546772 [ncp.at] TRACE: > AT+URAT?
0000546774 [ncp.at] TRACE: < +CME ERROR: Operation not supported
0000546775 [ncp.at] TRACE: > AT+CEDRXS?
0000546777 [ncp.at] TRACE: < +CEDRXS:
0000546778 [ncp.at] TRACE: < OK
0000546778 [ncp.at] TRACE: > AT+CPSMS=0
0000546781 [ncp.at] TRACE: < OK
0000546781 [ncp.at] TRACE: > AT+CMUX=0,0,,1509,,,,,
0000546785 [ncp.at] TRACE: < OK
0000546785 [gsm0710muxer] INFO: Starting GSM07.10 muxer
0000546786 [gsm0710muxer] INFO: Openning mux channel 0
0000546786 [gsm0710muxer] INFO: GSM07.10 muxer thread started
0000546788 [gsm0710muxer] INFO: Openning mux channel 1
0000548058 [ncp.at] TRACE: > AT
0000548058 [ncp.at] TRACE: < +CGEV: ME DETACH
0000548061 [ncp.at] TRACE: < OK
0000548062 [ncp.client] TRACE: NCP state changed: 1
0000548062 [net.pppncp] TRACE: NCP event 1
0000548063 [ncp.at] TRACE: > AT+CIMI
0000548070 [ncp.at] TRACE: < 310410316677468
0000548070 [ncp.at] TRACE: < OK
0000548070 [net.pppncp] TRACE: PPP netif event from queue: 4
0000548071 [net.pppncp] TRACE: NCP event 3
0000548071 [net.pppncp] TRACE: NCP power state changed: IF_POWER_STATE_POWERING_DOWN
0000548072 [system.nm] TRACE: Interface 4 power state changed: 3
0000548073 [ncp.client] TRACE: Try powering modem off using AT command
0000548074 [ncp.at] TRACE: > AT+CPWROFF
0000548080 [ncp.at] TRACE: < OK
0000548081 [ncp.client] TRACE: Waiting the modem to be turned off...
0000548321 [net.pppncp] TRACE: NCP event 3
0000548321 [net.pppncp] TRACE: NCP power state changed: IF_POWER_STATE_DOWN
0000548322 [system.nm] TRACE: Interface 4 power state changed: 1
0000548322 [ncp.client] TRACE: It takes 241 ms to power off the modem.
0000548323 [gsm0710muxer] INFO: Stopping GSM07.10 muxer
0000548324 [gsm0710muxer] INFO: Gracefully stopping GSM07.10 muxer
0000548324 [gsm0710muxer] INFO: Closing all muxed channels
0000548324 [gsm0710muxer] INFO: Closing mux channel 1
0000548325 [gsm0710muxer] INFO: Muxed channel 2 already closed
0000548325 [gsm0710muxer] INFO: Muxed channel 3 already closed
0000548326 [gsm0710muxer] INFO: Muxed channel 4 already closed
0000548327 [gsm0710muxer] INFO: GSM07.10 muxer thread exiting
0000548327 [gsm0710muxer] INFO: GSM07.10 muxer stopped
0000548328 [ncp.client] TRACE: Setting UART voltage translator state 0
0000548329 [ncp.client] TRACE: Soft power off modem successfully
0000548329 [ncp.client] TRACE: Deinit modem serial.
0000548411 [system.sleep] TRACE: Interface 3 is off already
Serial connection closed. Attempting to reconnect...
and here is what it is supposed to look like:
Serial monitor opened successfully:
0000244293 [app] INFO: Sleeping
0000244293 [app.ab1805] INFO: setWDT 0
0000244294 [app.ab1805] TRACE: watchdog cleared bResult=1
0000244294 [system.sleep] TRACE: Entering system_sleep_ext()
0000244295 [system.sleep] TRACE: Interface 4 is off already
0000244296 [system.sleep] TRACE: Interface 3 is off already
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
In this sequence, the device is awoken by a hardware interrupt, services the interrupt and goes back to sleep. As my sketch is quite long, here are a few relevant snippets.
case NAPPING_STATE: { // This state puts the device in low power mode quickly
if (state != oldState) publishStateTransition();
if (sensorDetect || countSignalTimer.isActive()) break; // Don't nap until we are done with event
if (sysStatus.connectedStatus) disconnectFromParticle(); // If we are in connected mode we need to Disconnect from Particle
stayAwake = 1000; // Once we come into this function, we need to reset stayAwake as it changes at the top of the hour
ab1805.stopWDT(); // If we are sleeping, we will miss petting the watchdog
int wakeInSeconds = constrain(wakeBoundary - Time.now() % wakeBoundary, 1, wakeBoundary);
config.mode(SystemSleepMode::ULTRA_LOW_POWER)
.gpio(userSwitch,CHANGE)
.gpio(intPin,RISING)
.duration(wakeInSeconds * 1000);
SystemSleepResult result = System.sleep(config); // Put the device to sleep
ab1805.resumeWDT(); // Wakey Wakey - WDT can resume
fuel.wakeup(); // Make sure that the fuel gauge wakes quickly
fuel.quickStart();
if (result.wakeupPin() == intPin) { // Executions starts here after sleep - time or sensor interrupt?
stayAwakeTimeStamp = millis();
}
else if (result.wakeupPin() == userSwitch) setLowPowerMode("0");
state = IDLE_STATE; // Back to the IDLE_STATE after a nap - not enabling updates here as napping is typicallly disconnected
} break;
So, my question is - why is the device powering off “interface 4” repeatedly?
Thanks,
Chip