I am having some trouble dealing with xbee s2 sleep mode. Hope you all can give me some help.
The following is my setup:
The network composes of one coordinator and several end devices, all in transparent mode The coordinator is connected to X-CTU and a computer and receives all the messages.
End devices are connected to another MCU(MSP430), MCU wakes up xbee periodically(8 seconds, 16 seconds, 48 seconds etc), writes a short message (11 bytes) to xbee through UART, then immediately asserts sleep_rq pin of xbee.
Here is the problem:
if I set the wakeup interval at 8 seconds, then all messages from the same end device will come in two messages batch at roughly 16 seconds interval instead of one message every 8 seconds.
If I set the wakeup interval at 48 seconds, then again, all message still tend come in two messages batch roughly every 96 seconds, plus the last two bytes of the second message constantly get lost.
The SN, SP on both coordinator and end devices are set properly. The RO is at default value 3.
If I don't assert sleep_rq pin of xbee and keep xbee awake all the time, then no matter what the interval between two messages is, all the messages come in one by one at defined interval.
I believe this has something to do with packetization but I could figure out the exact problem.
Edit: I believe at certain conditions, when sleep_rq is asserted, message up to certain length will be retained in the transmit buffer of xbee until xbee being waken up next time. I am wondering if there is any way to force xbee to send out everything before entering into sleep. One way of doing this is to write enough dummy byte to fill up the entire transmission buffer(84 byte in transparent mode without encryption). But this is really a waste of limited throughput of xbee network. So I hope someone can come up with something better.
This is driving me crazy. Some one please direct me to some relevant literature.
Thanks in advance,