XBee Cyclic Sleep Example: Indirect Messaging

Sleep modes can be used to effectively reduce power consumption and extend battery life. Indirect messaging is one way in which the XBee family of radios can conserve power through periodic sleep and wake cycles. During these sleep cycles, a base node can hold messages for sleeping remotes. When the remotes wake from sleep, a poll request is sent to the base, at which point the base could have information or request information from the remote radio.

The Coordinator will accept a message addressed to a specific remote 16 or 64 bit address and hold on to it in a buffer until the remote wakes and sends a poll requesting the information. These messages are referred to as indirect messages. The Coordinator will only queue one indirect message at a time. The Coordinator will hold on to the indirect message for a period of 2.5 times the sleeping period indicated by the SP (Cyclic Sleep Period) parameter. A remote in cyclic sleep will awaken once a period, and send a poll request to the Coordinator to ask for any indirect messages.

Note: An indirect message can only be held for a unicast message.  Indirect messaging does not work with a broadcast packet.

If no indirect message is queued for the remote, the Coordinator will not transmit, and the remote will return to sleep for another cycle. This process consumes approximately 30ms of the cycle period. If a message is being held for the sleeping remote, the Coordinator will transmit the indirect message, and the remote will stay awake according to the ST (Time Before Sleep) parameter. The ST command is used to set the period of inactivity before activating Sleep Mode, any activity will reset the ST timer.

When configuring a cyclic sleeping remote, one module should be enabled as a Coordinator (CE = 1). The SM (Sleep Mode) parameter should be set to one of the cyclic sleep options. Follow these guidelines for configuring the SP and ST times:

The SP of the Coordinator must be greater than or equal to the SP of the longest sleeping remote. The ST of the Coordinator must be less than or equal to the ST of the longest sleeping remote.

For purposes of desktop testing, the following example will set a remote in cyclic sleep (SM=4) for a period of 5 seconds. The remote will then stay awake for a period of 5.5 seconds after transmission has completed. 16 bit addressing will be used to identify the modules. All unlisted parameters are assumed to be default.

Coordinator Remote
CE = 1  
DL = 1234 DL = 5678
MY = 5678 MY = 1234
  SM = 4
ST = 1388 ST = 157C
SP = 226 SP =1F4

With the Coordinator and remote nodes attached to two different COM ports on the PC, run two separate X-CTU sessions. In the Terminal tab of the remote, the CTS line status indicator will turn off. Every 5 seconds, CTS will blink, indicating the module is waking from sleep and polling the Coordinator for indirect messages.

To illustrate the sleep and awake polling cycle, please refer to the trace below. The CTS line remains high in sleep, when the radio wakes up, CTS goes low indicating its awake sequence. The trace below indicates a cyclic sleep cycle of ~100ms. The awake sequence will last approximately 30ms.




From the Coordinator, compose a packet from the Assemble Packet option in the Terminal window. Once Send is selected the message will appear in the terminal. No more than 5 seconds later, the remote will wake up and poll the Coordinator for an indirect message. The Coordinator will respond to the remotes request with the indirect message. The message will appear on the remotes terminal. The remote will now remain awake (which can be verified by the status of the CTS line in the Terminal tab) for 5.5 seconds, after which time the remote will return to sleep for yet another sleep cycle.


Last updated: Aug 23, 2017

Filed Under

GatewaysRFRF Dev kits

Recently Viewed

No recently viewed articles

Did you find this article helpful?