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.

Zigbee Tree Addressing (Cskip) Explained

Other Parts Discussed in Thread: Z-STACK, CC2430

Hi everyone,

There have been quite a number of posts asking about network configuration using the tree addressing scheme (aka Cskip) used in Zigbee (non Pro - 2006 or 2007). You will need the Cskip spreadsheet which I have attached to my "My Files" section. Please download it and use it to understand what "legal" configurations can be used. The spreadsheet will give you an error if you venture outside the bounds of the parameters that govern the address assignment (i.e. MAX_CHILDREN, MAX_ROUTERS, MAX_DEPTH).

In addition to what is already mentioned in the Z-stack Developer's Guide,  I offer the following tips and conventions/rules:

1) The maximum number of devices that can be supported by one router or coordinator (i.e. associated devices) is 32. This is because we use a 32-bit bitmask to keep track of assigned addresses. Therefore, the NWK_MAX_DEVICE_LIST should be set to 32 maximum.

2) The setting for MAX_CHILDREN MUST match the setting for NWK_MAX_DEVICE_LIST. e.g. see here that by default NWK_MAX_DEVICE_LIST is set to 20 by default and matches the value in this cskip array in nwk_globals.c:
byte CskipChldrn[MAX_NODE_DEPTH+1] = {20,20,20,20,20,0};

3) MAX_CHILDREN must always be greater than MAX_ROUTERS. Therefore, a setting of 1, and 1 is not valid.

4) An example Cskip array setting for the configuration MAX_CHILDREN = 2, MAX_ROUTERS = 1, and MAX_DEPTH = 15. This provides an total of 31 addressable nodes. If you think of the number of available addresses as a pyramid, this pyramid is REALLY, REALLY skinny. :) So then:

#elif ( STACK_PROFILE_ID == NETWORK_SPECIFIC )
    byte CskipRtrs[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
    byte CskipChldrn[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
#endif

becomes

#elif ( STACK_PROFILE_ID == NETWORK_SPECIFIC )
    byte CskipRtrs[MAX_NODE_DEPTH+1] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0};
    byte CskipChldrn[MAX_NODE_DEPTH+1] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0};
#endif

and then MAX_NODE_DEPTH should be set to 15. NWK_MAX_DEVICE_LIST should be set to 2.

5) Last but not least, DO NOT mix and match Cskip settings as it will mess up the tree addressing. Using a network specific configuration means that you greatly reduce the chance of interoperability with another network that has a different network configuration (such as Zigbee Home Automation).

  • Hi Double 0,

    Is it the same Cskip.xls mentioned in Z-Stack developers guide? I cant find the file in the directory mentioned in the guide.

    Something in the sheet I dont quite understand, is the maximum node number 65536? (because the network address is only 16bits? not sure)  but in the sheet it says l

    ess than 65534, do you know the why? and which values should I assign to get for a max node of 65534?

    Thank you very muh!

     

  • Hi D0,

    Thanks for the explanation, it is very clear.

    In addition, is it possible to access the 32-bit bitmask and mark some addresses as assigned in customized code for router replacement?

    Is it possible to manually control the network address assignment in zigbee stack 1.4.3? I still think it is very necessary in router/coordinator replacement with NV_RESTORE option enabled.

    Cheers,

    Henry

  • Yes, it is the same spreadsheet. It's missing from the folder so I attached it in my "My Files" section The addresses 0xFFFC-0xFFFF are reserved for special broadcast addressing so it is actually less than 65534.

    It is not possible to fix the addresses.

  • Hello,
    I'd like you ask you a question please.

    You said that "The maximum number of devices that can be supported by one router or coordinator (i.e. associated devices) is 32".
    Does it mean that if a coordinator builds up a network, then only 32 routers could join this network?

    Is there any way to have a network with one coordinator and more than 31 routers?

    Thank you very much.

  • Hi arbi tel,

    What is meant is that the coordinator or each router can only have 32 devices associated to it directly; however, each of these can then again have 32 associated to it (unless they are end devices, as end devices cannot accept associations).

    Example:

     A coordinator starts the network and then 32 devices associate to it (let's say 6 routers and 26 end devices).

    Then each of these 6 routers can each allow another 32 devices to be associated to it. This continues until the maximum depth is reached.

    This way the full address space can be used in a tree type topolgy.

    Let's say that each of the 6 routers gets joined by 6 new routers and that this continues until depth 5, then the NWK would have 6 (depth 1) * 6 (depth 2) * 6 (depth 3) * 6 (depth 4) * 6 (depth 5) = 7776 routers.

    Remark: The association and address assignment structure (tree) does not mean that the network is a tree network as this only counts for the address allocation. Messages can still travel between any devices that can hear/see each other as they are in radio range (only exception is are end devices that communicate only through their parents).

    Hope this helps!

    -LL-

  • It helps so much, thank you a lot. :)

    When you say that coordinator or router can only have 32 devices associated to it directly, you mean that a coordinator and a router can permit joining to only 32 devices?

    And, dont you mean 31 devices?

    Moreover please, why is that limitation?
    Why not enabling have a coordinator or router more than 32 children?

    Thank you very much for your time and help.
    It is much appreciated.

  • Yes, they only allow maximum 32 devices to be associated to them at a time (see Double 0 comments in http://e2e.ti.com/forums/p/1418/20122.aspx#20122 for further details).

    -LL-

  • Thank you very much for all of your help Luke :)

    Could you tell me please, how can I know how many devices have associated to the parent (Coordinator/router)?

    I want to build up a network that consists of 1 coordinator and more than 32 routers, and I want to know when the coordinator reaches having 32 childs (router childs) so at that point i'll add routers no to the coordinator but to the router.

    Thank you very much.

  • hi arbi tel,

    You can use the function: AssocCount() to return the number of devices in AssocDevList.

  • Hello arbi tel,

    Not sure whether I get your last question correct, but you do not need to take care of adding the new routers to specific routers or the coordinator. In a mesh network you should add the devices such that it has several routers in radio range and then it will choose itself which router to join. You do not need to keep count of this, it is done automatically by the stack.

    -LL-

     

  • Hey, thank you both for your help.

    LuckyLuke,
    In order to let a new router to join network, I need that the one/some of the routers (or coordinator) will issue the NLME_PermitJoiningRequest command (This is how I so far had coordinator allowing routers to join its network, while the new routers only started them self in network by issuing ZDOInitDevice command).

    So are you saying that when a new router wants to join network, I should have all routers (and coordinator) in network to issue the NLME_PermitJoiningRequest command, and the router will pick the highest level router within range?

    Moreover, i wanted to ask you please (I hope its ok), is it realistic to have the coordinator running a network of about 800 routers? (In such way that every router has up to 32 children of course)
    For example, in our application the coordinator needs to receive data from all the 800 routers every hour, and some times it even needs to receive from them "real time data" every few seconds.
    Is it realistic?

    Thank you very much, I appreciate it.

  •  

    Hi again,

    What I was trying to say is that when you e.g. use the ZigBee sample applications that are included in the Z-Stack, then you can use the included projects for 1 coordinator and several routers. Then they will automatically join the network without you having to set it all up.

    As I have no experience with networks of the size that you refer to I cannot really comment on it, but here my thoughts:

    From an addressing and joing perspective I do not see an issue; however, from a messaging perspective I see an issue. The network is on one channel and the physical maximum throughput of the RF channel is shared by all nodes in radio range as they cannot transmit at the same time (IEEE 802.15.4 has implemented one kind of channel assesment algorithm with back off times etc. to avoid collision of packets sent). As a consequence I would guess you might be fine if the 800 nodes report randomly in time (let's say once every hour). However, when you talk about "real time" I think it cannot be done; especially if you want 800 nodes to contact the central node every few seconds at the same. How much is a few???

    I guess you would have to make some experiments.

    -LL-

  • I think that I'd do a bunch of modeling and studies before I tried a network of this scale. Depending on the timing, etc of what you're doing, you're either pushing the envelope or you're way outside of it.

    Scott

  • Hi and thank you very much again.

    I really appreciate your comments.

    First, about the data that the coordinator receive from the routers once every hour.
    What happens now (but not with 800 routers) is that once every hour, the coordinator asks from all the router to send now their data and they all do it right away at the same time.
    Will this work?

    Second, about the 'real-time' data, it is received every X seconds, where X can be any number between 3 seconds to 10 seconds.
    I know we should test it, but do you have an estimation of what is the minimum value of X for it the 'real-time' process will work?

    Thanks alot.

  • As I wrote yesterday I have no idea about large networks, but the idea of having 800 devices answer all at once (e.g. as response to a broadcast) sounds crazy to me.

    Just imagine a group of 800 children and a person asking "who wants candy"? Even if the kids were trained to listen first and wait for their turn before they speak it is not possible to do this quick enough and without collisions :-)

    Have you thought of making several smaller networks where each has a gateway device (e.g. to the internet)?

    What kind of latency do you expect when calling this "real time"?

    If I am not wrong the maximum physical data rate of a channel is ~250kB/s, so when considering two nodes only, they might achive an effective data rate of ~120kB/s (due to MACK ACK transmissions and the CSMA-CA algorithm). If you now couple one hop inbetween them you already half your data rate as only one of the links can transmit at a time, as the hop in the middle cannot transmit (sending on a message) at the same time as the node transmits (that tries to send the next packet), so then you are already down to ~60kB/s in an ideal case, so the more nodes you add that try to send often and a lot of data (whether coming from themselves or by routing from further distant nodes) I can see that you quickly get filled up. Hence, 800 nodes that send regulary every few seconds sounds too much to me, but I have no clue where to put the limit, sorry.

    Maybe someone else here has an idea???

    -LL-

     

  • Thanks again look, as always it is so appreciated.

    So i just want to have it clear regarding the 'once-every-hour' data.

    If the coordinator asks once every hour for data from 800 routers, and they answer immediately, will they all manage to send the data to the coordinator?
    The latency is not important here, since it happens once every hour.

    Again, I thank you.

  • No idea, but I doubt it.

    Just some thoughts before I leave this discussion as I really have no clue and experience regarding large networks.

    Were you thinking of sending a broadcast to all routers saying "Please report the data xyz"? If they then all simply try straight away to send they will colide with others and there will be many back-off periods and many messages routed through the network. So maybe let them generate a random number each and put them to sleep that many seconds before sending xyz to avoid that they all send at the same time.

    Especially the routes/hops close to the coordinator will get hot/busy/overloaded? in your scenario

    Are you using ZigBee PRO (Z-Stack 2.x.x), which provides a special routing scheme for such a scenario? If not I am sure it will not work as the routing tables close to the central node will explode.

    Bye for now

    -LL-

  • Starting with the 800 responses every hour at the same moment ... That doesn't look like a good idea to me. Trying asking all 800 people in an auditorium to tell you their names at once, and you'll see the problem. Unless the set the retry number pretty high, there's a good chance that quite a few nodes would just give up resending. Not to mention the huge power waste resending all that data. It would be better to send out a single "Take sample" command, then ask smaller groups of the 800 to transmit their data (or even query each node). When you have that data, you can move to the next group.

    Now the real-time stuff: I don't remember how many nodes we're talking about for the "real-time" data, but take the payload size and add the overhead to figure out the entire transmitted data size in bytes (this won't reflect the DSSS coding). Assuming this is a transmission initiated by the sending device, and not requested, take:

    (that packet size + MAC acknowlegement size)/ about100kbps

    That should give you a rough idea of how many nodes can reliably send that data.

    Scott

  • I really thank you both, friends.

    I'll go on the trial&error method and see how it works out, you gave me a great point to start from.

    As to the network issue, I got it worked out, and just wanted to understand something please.

    When a parent leaves network (NLME-LEAVE.request command), with the remove-children option enabled, how does it remove its childs from network?
    Must the childs be ON when the parent leaves network so the parent will be able to remove its childs from the network?

    Thank you again very much.

  • Usually the parent is the only device with knowledge of its children. If the parent goes away, those children are left in an orphaned state. The usual ZigBee function is to first try to find a new parent and, failing that, try to find a new network.

    Scott

  • Thank you for your response.

    Could you tell me please how do the children know that their parent has left the network?

    If you could please treat the situation when they are off while the parent is leaving, and when they are on while the parent is leaving.

    Thank you very much.

  • The same way a kid knows that Mom is gone in the department store. He calls for her and she doesn't answer.

    The End Device sends a message, gets no answer and continues to resend until its resend setting runs out. At that point it decides it's a orphan.

    It's not like the parent says "goodbye" ... although you could potentially tell your children that you're going away. But if the parent's power fails, the orphaning process works fine.

    Scott

  • Thank you very much scott :)

    By the way, is there any document which contains all this information?

    There are so many details to be known, and its important for me to understand all this.

    Thanks.

  • Using the removechildren flag in the leave request is tricky for tree addressed based systems. Consider removing a router child that has other router children which have end device children of it's own. The stack doesn't handle this automatically so you will carefuly have to handle this at your application level. As this could cause more problems than actually help, it's best not to use the leave request unless it's directed to an end device. There's no real danger of damaging the tree topology if you're just removing the end nodes.

    When an end device loses connection with its parent, the ZDO_SyncIndicationCB function will be called. Typically this happens when the parent does not respond to the end device's messages (could be a poll request or any AF message for up to 8 times in a row - using default settings in f8wconfig.cfg).

    If you haven't already gone through it, start with the Z-stack Developer's Guide. The Z-stack Sample Applications document is also a good place to learn how OSAL works (how to start an application timer, set an event, etc.). You should also look at the Wiki page post that's on the front page of this forum. Lot's of good training material there.

    -- "Double O"

  • Hey,

    I performed the following (only) 4 changes for my CC2430 mesh network, in order to increase the network to 32 devices which 31 of them are routers.
    I followed all the rules that were mentioned here and in Cskip.xls file and in the Zstack Developer's Guide, but these is still a problem:

    When Coordinator / Router start themself in network, by issuing the function ZDOInitDevice, it takes for this function a ~minute (!) to complete.
    Can anyone tell me what am i doing wrong please?

    Thanks.

    1. #define STACK_PROFILE_ID      NETWORK_SPECIFIC

    2. #define NWK_MAX_DEVICE_LIST     32

    3. inside " #elif ( STACK_PROFILE_ID == NETWORK_SPECIFIC ) ", I changed:

    #define MAX_NODE_DEPTH          3

    In nwk_globals.c:

    4.
      #elif ( STACK_PROFILE_ID == NETWORK_SPECIFIC )
        byte CskipRtrs[MAX_NODE_DEPTH+1] = {31,31,31,0};
        byte CskipChldrn[MAX_NODE_DEPTH+1] = {32,32,32,0};

  • Hello Double 0,

    i want to know what are the maximum values to the ZIgbee-Pro Stack?

    i.e. MAX_CHILDREN, MAX_ROUTERS, MAX_DEPTH, "MAX_HOPS"?

    we are going to use an network with thousand of routers and few end devices conected to these routers , and we want to send messages from one end-device in one side of a city to another end-device in the other side of the city.

    It seem that there is an limitation of 255 hops in the network. Is it true?

    Thanks

  • Hi, Double 0,

    I noticed that in f8wconfig.cfg file, there is no definitions for the 8 times of retry. The most related one is DAPSC_MAX_FRAME_RETRIES but it is defined to be 3. I do noticed from the packet sniffer that the retry is 8 times. Would you please clarify? Thanks.

    Yuan Jian

  • Hi Double 0,

    When the fist time i read this, i believe you are right!

    1) The maximum number of devices that can be supported by one router or coordinator (i.e. associated devices) is 32.

    but now i am puzzled.

    I have 34 device, 1 coordinator.

    fist, i let 32 end devices join the network, it's OK.

    then i let the 33rd end device join the network, it can join, and work well.


    so, i have a question,how many end devices (only end device), that 1 coordinator  can support .


    Thanks!

  • Thanks for sharing your knowledge. Its so useful for amateur guys like me.

    But I can't find the Cskip spreadsheet. Could you please be more clear about that document?

    Thanks in advance.