MAX_DEPTH决定了网络的最大深度。协调器(Coordinator)位于深度0,MAX_DEPTH
参数限制了网络在物理上的长度,这个值默认是5,最大不能超过15。
MAX_CHILDREN决定了一个路由(Router)或者一个协调器节点可以处理的儿子节
点的最大个数。
MAX_ROUTER 决定了一个路由(Router)或者一个协调器(Coordinator)节点可以
处理的具有路由功能的儿子节点的最大个数。这个参数是 MAX_CHILDREN的一个子
集,终端节点使用(MAX_CHILDREN – MAX_ROUTER)剩下的地址空间。
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).
For more deatils about zigbee check the below links.