
Sleep modes
About sleep modes
XBee Wi-Fi RF Module User Guide
52
About sleep modes
The XBee Wi-Fi RF Module supports two different sleep modes:
n
Pin Sleep
n
Cyclic Sleep
In addition, you can modify the sleep mode current draw with the following sleep options:
n
AP Associated Sleep
n
Deep Sleep
Pin sleep allows an external microcontroller to determine when the XBee Wi-Fi RF Module should
sleep and when it should wake by using either the SLEEP_RQ pin (default) or the SPI_SSEL pin. In
contrast, cyclic sleep allows the sleep period and wake times to be configured using AT commands.
The device can stay associated to the access point or can enter a deeper sleep and associate to the
access point for each sleep/wake occurrence. The sleep mode is configurable with the
SM
and
SO
commands.
Each of the sleep modes operate differently based on the serial interface (UART or SPI).
Use the UART Sleep mode
When the serial interface is UART, the ON_SLEEP pin is used to indicate that the device is entering
sleep mode, unless it is configured for a different usage. If you configure
for
ON_SLEEP, then it is driven low when asleep and high when awake, whether using pin sleep or cyclic
sleep.
If you enable CTS hardware flow control with
, the CTS pin is de-asserted
(high) when entering sleep to indicate that serial data should not be sent to the device. The device will
not respond to serial or RF data when it is sleeping. Applications that use the UART are encouraged to
observe CTS flow control in any of the sleep modes. When the XBee Wi-Fi RF Module wakes from sleep
with flow control enabled, the CTS pin is asserted (low).
If using pin sleep, you must configure
for SLEEP_RQ to put the device to sleep.
Otherwise, there is no sleep at all, meaning the device always stays awake in full power mode. When
you configure
D8
for SLEEP_RQ, the host should drive SLEEP_RQ high to put the device to sleep, and
the host should drive SLEEP_RQ low to wake up the device.
Use the SPI Sleep mode
When the serial interface is SPI, SPI_ATTN is used as an attention indicator to tell the SPI master
when it has data to send. Since SPI only operates in API mode, it asserts SPI_ATTN and sends out a
modem status indicator after initialization. The host can use this to know when the device is ready to
operate as a SPI slave. Since the function of SPI_ATTN is to indicate when the device has data to send
to the host, it may legitimately be driven high or low while the device is awake.
When using the SPI, either SLEEP_RQ or SPI_SSEL may be used for pin sleep. If D8 is configured as a
peripheral (1), then it will be used for pin sleep. If not, and SPI_SSEL is configured as a peripheral
(which it must be to enable SPI operation), then SPI_SSEL is used for pin sleep.
Using SPI_SSEL for pin sleep has the advantage of requiring one less physical pin connection to
implement pin sleep on SPI. It has the disadvantage of putting the device to sleep whenever the SPI
master negates SPI_SSEL, even if that was not the intent. Therefore, if you can control SPI_SSEL,
whether or not data needs to be transmitted, then sharing the pin may be a good option. It makes the
SLEEP_RQ pin available for another purpose, or it simply requires one less pin to the SPI interface.