This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: Make End Device route traffic between all nodes

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK, , CC1310

Hi,

How would it be possible to make an end device with the capability to pass on data from other devices (route traffic) between all nodes? The end device I use has a poll rate of 1 second. So perhaps every time it wakes up, it can relay the information from one node to the next. A router has this functionality, but it can't go into sleep which is why I need an end device. So is it possible to do this? I'd very much appreciate any help provided.

  • No, end device cannot route messages.
  • Do you know what functions/parts of the Z-Stack SampleLight Router contain code for routing the traffic between nodes?
  • This part is in Z-Stack library and not available for application developers.
  • If I configure as a router, is there any way to make it sleep with a poll rate of 1 second?
  • I read from en.wikipedia.org/.../Zigbee which said ZigBee can support beacon enabled routers (below is what it said). How would it be possible to configure a router as a beacon-enabled network so it only sends periodic beacons instead of constantly always being active?

    "In beacon-enabled networks, the special network nodes called zigbee Routers transmit periodic beacons to confirm their presence to other network nodes. Nodes may sleep between beacons, thus lowering their duty cycle and extending their battery life. Beacon intervals depend on data rate; they may range from 15.36 milliseconds to 251.65824 seconds at 250 kbit/s, from 24 milliseconds to 393.216 seconds at 40 kbit/s and from 48 milliseconds to 786.432 seconds at 20 kbit/s. However, low duty cycle operation with long beacon intervals requires precise timing, which can conflict with the need for low product cost."
  • As I know, you cannot configure such thing in Z-Stack.
  • Would the solution mentioned at e2e.ti.com/.../1543691 work? Could I use this method so it will go to sleep and then use a poll rate to wake it up?
  • There is no poll rate setting in router. I don't think this gonna work.
  • 1. Does this actually put the router to sleep?
    2. Could I just use an osal timer as a poll rate?
  • Yes, it would put CPU to sleep after you call hal_sleep and you can use timer event to wake it up.
  • So are there any other reasons this method may not work?
  • When you make router sleep, its child nodes will lose parent and need to find new parent and routing path. It will take some time to make messages routing back to normal.
  • Is there a way to disable "lost parent" functionality. This way when a device doesn't see its parent, it won't do anything about it and keep on doing whatever it was doing. Do you know of a way to do this? Could I just get rid of all the code related to the "lost parent" functionality?

  • Unless you stop polling completely and don't send any message from end device, you cannot avoid "lost parent" functionality.
  • Could I just get rid of all the code related to the "lost parent" functionality?
  • No, you can't.
  • Why is that so?
  • That is how Zigbee spec defines and you cannot change it arbitrarily.
  • 1. The command "halSleep(0)" seems to make the CC2530 router go into deep sleep mode (PM3). So if I make it go into PM2 instead of PM3, would other devices still lose their parent? Also when the router goes into PM2, will the coordinator see the router as lost?

    2. If I set RFD_RCVC_ALWAYS_ON to FALSE for a router, will the router do sleeping and polling?

  • 1. hal_sleep actually makes device enter PM2 not PM3 and other devices still think they lose their parents.
    2. No. you cannot mess Z-Stack like this.
  • 1. Is there a way to make the router let other devices know that it's going to sleep so that other devices don't lose their parent?

    2. Even when 2 routers aren't synced up (not waking up at exact time), would the router passing the information from the coordinator keep sending the message to the other router until it is received? This way it doesn't matter if both devices are synchronized.

    3. Is there any way to lower the power consumption of a router to 20 uA or less (like PM2) without making other devices think they lost their parent? (Because an end device can go to PM2 and the coordinator doesn't think the end device is lost)

  • 1. I already told you that it's not feasible.
    2. No, coordinator won't keep sending messages.
    3. No.
  • How does an end device go into PM2 without the coordinator thinking the end device is lost?
  • Is coordinator the parent of the end device you mean here?
  • Yes it is.
  • If ZED doesn't polling and send message, it won't know parent lost.

  • So I've managed to get the router to sleep when connected to a coordinator. So I have it sleep for 1 second and wake up for 10ms and then repeat infinitely. This is the same pattern as an end device. However I noticed that the router doesn't always respond with this poll method unlike an end device. 10ms awake isn't enough time for a router, but it is plenty for an end device to receive this signal. Why can't a router receive the signal within 10ms unlike and end device? What do you suggest to fix this?

    I used the below to do polling for a router...

    if( events & sleep){
    unsigned char rxOnIdle;
    //turn off ZigBee task
    nwk_setStateIdle( TRUE );
    // turn MAC receiver off
    rxOnIdle = false;
    ZMacSetReq( ZMacRxOnIdle, &rxOnIdle );

    halSleep(1000);

    //turn on ZigBee task
    rxOnIdle = true;
    ZMacSetReq( ZMacRxOnIdle, &rxOnIdle );
    // set NWK task to run
    nwk_setStateIdle( FALSE );

    osal_start_timerEx( zclSampleLight_TaskID, sleep, 1010);
    return (events ^ sleep);
    }

  • Are you sure your router and end device have synchronized time while sleeping and wake you? I think they are not so that why you see the problem.
  • I don't use an end device at all. I use the router like an end device which is connected to a coordinator.
  • Then, what do you mean "you noticed that the router doesn't always respond with this poll method unlike an end device?"
  • When I send a command to the router from the coordinator, the router doesn't respond. When I send a command to the end device from the coordinator, the end device responds. Below is what the oscilloscope shows from the polling for both end device and router configurations. The router never responds, but the end device can within the 10ms of TX/RX. The router only responds if it does TX/RX for at least a second. So how can I get the router to respond within 10ms every time it polls for 1 second?

  • Since router only does receiving on that 10 ms window, it means you have to send message in that window of rx on. Otherwise, it cannot receive anything. From my point of view, you are messing up Zigbee protocol.
  • Well why can ZED receive fine in 10ms window and not router? What possible reasons cause this problem for the router?

  • If you read Zigbee spec, you should know ZED use polling to receive message from parent node and that's why ZED works and ZR not.
  • Well the below code seems to make the router do polling as well. It basically turns everything off, sleeps for 1 second, turns everything back on (active mode) for 10ms, then repeats. I'm not sure why this may be causing problem. Can you spot anything as to why this may cause the router this problem? What's the difference between the regular ZED polling and this router polling?

    if( events & sleep){
    unsigned char rxOnIdle;
    //turn off ZigBee task
    nwk_setStateIdle( TRUE );
    // turn MAC receiver off
    rxOnIdle = false;
    ZMacSetReq( ZMacRxOnIdle, &rxOnIdle );

    halSleep(1000);

    //turn on ZigBee task
    rxOnIdle = true;
    ZMacSetReq( ZMacRxOnIdle, &rxOnIdle );
    // set NWK task to run
    nwk_setStateIdle( FALSE );

    osal_start_timerEx( zclSampleLight_TaskID, sleep, 1010);
    return (events ^ sleep);
    }

  • Again, I would say you are messing up thing. When a router joins, it broadcast end node announcement to tell everyone it is a router and all others would send messages to router directly. Other nodes won't use polling mechanism to send message to a router.
  • I understand the consequences and that problem exists, but what is wrong with the code above. All it does is turn things off, sleep 1 second, and turn things on? At this point it is in regular router mode and should be able to receive from the coordinator just fine, but yet it doesn't. Basically all I did was let the router sleep every once in a while. So if the receiver is on when awake, why can't the router receive anything within 10ms like a ZED?

    The router needs 1 second every time it wakes up before it can receive anything. Whenever a ZED wakes up, it can receive instantly. Why does a router need 1 second after waking up before it can receive anything?

  • As I said, a message for router would be sent out immediately and message for ZED would be kept on parent waiting ZED to polling for it. If the message is sent during ZR is sleeping, message won't reach ZR.
  • 1. Is there a way to make it so the message for a router is kept on parent until the router is polling for it?

    2. Is there a way to setup the same polling system from an end device onto a router?

  • No, ZR is not designed to work this way according to Zigbee spec.
  • Are you saying it's not possible, or that ZigBee specifications don't allow it, or both?
  • Hi Jack,

    What you are suggesting does not align with how Z-Stack is designed. Can you please explain your use case for "sleeping routers"? I am sure there is a proper solution but we need to understand what you are trying to do first.

    Z-Stack is designed on a non-beacon mode 802.15.4 MAC layer, which means there is no concept of "sleeping" parent devices in Z-Stack. Technically speaking, the Zigbee specification does not explicitly prevent you from designing a beacon mode 802.15.4 MAC (i.e. synchronous communication, sleeping parents, time slotting, etc), but there is not really a use case for this kind of Zigbee network in the real world since all Zigbee networks use asynchronous communication, i.e. you do not know when your child devices are going to send you data. In order to mitigate asynchronous communication, parent devices (routers and coordinators) MUST ALWAYS have RX on when in idle, they cannot turn their radio off and go to sleep or they would miss packets from their child devices.

    If you are interested in designing a network with a Beacon mode 802.15.4 MAC, you can check out one of our other products, TI 15.4-Stack, available in SimpleLink CC13x0 SDK:

    www.ti.com/.../SIMPLELINK-CC13X0-SDK
  • What I trying to make a device that acts like a router (pass messages from 1 device to another and also not check for parent loss), but I want it to do polling so that it can save energy and be powered by battery. Currently I've set my device as a router config and made a polling function. However when I tell the coordinator to turn on/off the device, it sends the message immediately and doesn't wait to see if the device polls. So the device doesn't receive the message when asleep. What do you suggest to help make this work?
  • Hi Jack,

    I understand what you are trying to do with Z-Stack. I am trying to explain to you that you cannot do this, it is outside of the scope of the feature set provided with Z-Stack that is available to developers. As I tried to explain before, sleeping parent devices is not a realistic use case in a normal Zigbee network due to the asynchronous nature of the protocol, therefore there is no reason to provide such a feature in Z-Stack.

    Is using Zigbee/Z-Stack + CC2530 a hard requirement? If not, I would urge you to try using TI 15.4-Stack on the CC1310/50 platform, you can set a network up using Beacon mode operation which will allow for "sleeping" parent devices.