本人参考了:http://blog.sina.com.cn/s/blog_3fb7f7270102v8tg.html
CC2530作为协调器最大可以带的子节点数量主要由以下参数决定:
NWK_MAX_ROUTERS,NWK_MAX_DEVICES,和MAX_NODE_DEPTH
这些参数在nwk_globals.h里
MAX_DEPTH决定了网络的最大深度。协调器(Coordinator)位于深度0,MAX_DEPTH
参数限制了网络在物理上的长度,这个值默认是5,最大不能超过15。
MAX_CHILDREN决定了一个路由(Router)或者一个协调器节点可以处理的儿子节
点的最大个数。
MAX_ROUTER 决定了一个路由(Router)或者一个协调器(Coordinator)节点可以
处理的具有路由功能的儿子节点的最大个数。这个参数是 MAX_CHILDREN的一个子
集,终端节点使用(MAX_CHILDREN – MAX_ROUTER)剩下的地址空间。
一般的应用几十上百个应该够了,如果对节点有高要求,TI有个文档论述了>400节点的方案,具体请参考这边:www.ti.com/lit/pdf/swra427
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).