
Sleep modes
The sleep timer
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
139
DIO8/SLEEP_RQ configured as
peripheral (D8 = 1)?
DIO3/SPI_SSEL configured as
peripheral (D3 = 1)?
Pin sleep controlled
by...
Yes
Yes
DIO8/SLEEP_RQ
Yes
No
DIO8/SLEEP_RQ
No
Yes
DIO3/SPI_SSEL
No
No
Neither (pin sleep
does not work)
Advantage of using SPI_SSEL to control sleep:
n
One less physical pin connection is required to implement pin sleep. This makes DIO8/SLEEP_
RQ available for another purpose.
Disadvantages of using SPI_SSEL to control sleep:
n
The XBee Smart Modem is put to sleep whenever the SPI master negates SPI_SSEL, even if
that was not the intent.
n
The XBee Smart Modem begins entering sleep as soon as the control pin is asserted (brought
high). Immediately de-asserting the control pin (bringing it low) only has the effect of
preventing the microcontroller from entering low-power mode before waking up the device—
all other sleep preparations (such as closing sockets) continue as in typical sleep operation.
This can take several seconds, and this added time in the case of an unintended sleep request
may not be acceptable.
The sleep timer
The sleep timer starts when the device wakes and resets on re-configuration. When the sleep timer
expires the device returns to sleep.
MicroPython sleep behavior
When the XBee Smart Modem enters Deep Sleep mode, any MicroPython code currently executing is
suspended until the device comes out of sleep. When the XBee Smart Modem comes out of sleep
mode, MicroPython execution continues where it left off.
Upon entering deep sleep mode, the XBee Smart Modem closes any active UDP connections and turns
off the cellular component. As a result, any sockets that were opened in MicroPython prior to sleep
report as no longer being connected. This behavior appears the same as a typical socket
disconnection event will:
n
socket.send
raises
OSError: ENOTCONN
n
socket.sendto
raises
OSError: ENOTCONN
n
socket.recv
returns the empty string, the traditional end-of-file return value
n
socket.recvfrom
returns an empty message, for example:
(b'', (<address from connect()>, <port from connect()>) )
The underlying UDP socket resources have been released at this point.