ZigBee Power Management using Cyclic Sleep example for mbed XBeeLib By Digi
This example characterizes a device that needs to be continuously joined to the coordinator so
it doesn't lose any incoming packets. A fast response to packets is not required so the radio can
sleep for some time to save power while the coordinator buffers its packets.
The example configures the radio to poll its coordinator every 5 seconds to check if there is any packet for it. If there is one or more, it awakes and send the packets to the mbed micro-controller.
In S2B modules, router firmware will not work for this example, because routers don't support sleep modes.
Make sure the XBee module has end-device firmware.
To flash new firmware into an XBee module, you need to use the XCTU software.
Make sure the coordinator has at Cyclic Sleep Period (SP) option a value greater than XBee module.
In the example it is set to 5000 which represent 5000 mS or 5 seconds.
In the coordinator, when using X-CTU for configuration, the SP parameter has to be entered as the desired sleep time divided by 10 and in hexadecimal so to cope with the example it should be 5000 / 10 = 500 = 0x1F4 -> 1F4
On a router or coordinator, SP determines the transmission timeout when sending to a sleeping end device. SP also determines how long the parent will buffer a message for a sleeping child.
While it is running, go to the "Console" tab of the X-CTU connected to the coordinator. Press the
"Add API frame to the list" and paste following bytes that create a new broadcast transmit request packet:
7E 00 19 10 01 00 00 00 00 00 00 FF FF FF FE 00 00 48 65 6C 6C 6F 20 58 42 65 65 21 5A
Select the frame and press the "Send selected frame" button to send the frame ("Hello XBee!") to the XBee network.
Once the XBee device receives the frame, the radio will wake up to send it to mbed micro-controller, which will process and print the received data.
Verify that the XBee module has received the frame by accessing the serial console terminal. If it was successful, the "Hello XBee!" message will be displayed there.
After that, the radio will go to sleep again until new data is received.