Protocol stack: Z-Stack 3.0.2
Coordinator processor: CC2538
Enddevice processor: CC2530
Problem Description:
How can I adjust the time when the parent node saves indirect information for the enddevice in Z-Stack 3.0.2?
There are macro definitions for the enddeivce's message caching feature in the "nwk_globals.c" file:
// 1-255 (0 -> 256) X RTG_TIMER_INTERVAL
// A known shortcoming is that when a message is enqueued as "hold" for a
// sleeping device, the timer tick may have counted down to 1, so that msg
// will not be held as long as expected. If NWK_INDIRECT_MSG_TIMEOUT is set to 1
// the hold time will vary randomly from 0 - CNT_RTG_TIMER ticks.
// So the hold time will vary within this interval:
// { (NWK_INDIRECT_MSG_TIMEOUT-1)*CNT_RTG_TIMER, NWK_INDIRECT_MSG_TIMEOUT*CNT_RTG_TIMER }
This shows that the time when the parent node caches the message for the enddevice is: { (NWK_INDIRECT_MSG_TIMEOUT-1)*CNT_RTG_TIMER, NWK_INDIRECT_MSG_TIMEOUT*CNT_RTG_TIMER }.
I set "-DNWK_INDIRECT_MSG_TIMEOUT" in "f8wConfig.cfg" to 4, and then set "CNT_RTG_TIMER" to 1, then the coordinator will save the information for the sleeping enddevice for 3-4 seconds?
I did a test:
1. First, I changed the number of information saved by the coordinator to the sleeping enddevice to 4 (#define NWK_MAX_DATABUFS_TOTAL 4).
2. Then change the time that the coordinator saves the message for the enddevice to 3-4 seconds (will be -DNWK_INDIRECT_MSG_TIMEOUT=4; #define CNT_RTG_TIMER 1).
3. Then I use the button to put the enddevice1 into deep sleep, and then the coordinator send six "read attribute" commands to the enddevice1.
4. After 7 seconds, the coordinator sends 6 "read attribute" commands to the online enddevice2. But the coordinator did not send any messages.
5. Then, the enddevice1 is awakened from deep sleep by pressing the button, and the enddevice 1 successfully receives five "read attribute"commands from coordinator.
This proves that the coordinator stores messages for the enddevice for more than 4 seconds. Why?