节点无法加入到网络
问题描述:
这边修改了最大节点数目,NWK_MAX_DEVICE_LIST 为30.
现象1 组网的时候发现设备低于30个的时候可以组网成功
现象2 但是设备大于30个的时候,只能组网7个。查看AssociatedDevList,发现数据满了,但是节点根本就没有组网。
不知道修改节点数量,有哪些需要注意的?为什么这样修改会导致无法组网。
协调器的配置如下:
/*
* f8wConfig.cfg
*
* Compiler command-line options used to define a TI Z-Stack ZigBee device.
* To move an option from here to the project file, comment out or delete the
* option from this file and enter it into the "Define Symbols" box under the
* Preprocessor tab of the C/C++ Compiler Project Options. New user defined
* options may be added to this file, as necessary.
*
* Each macro is prefixed with '-D'. The entries are to be constructed as if
* they are to be on the compiler command line invocation (which they are).
*
* NOTE: The RHS (Right-Hand-Side) must be quoted if there are embedded blanks.
* See the DEFAULT_KEY definition for an example.
*/
/* Enable ZigBee-Pro */
-DZIGBEEPRO
/* Set to 0 for no security, otherwise non-0 */
-DSECURE=1
-DZG_SECURE_DYNAMIC=0
/* Enable the Reflector */
-DREFLECTOR
/* Default channel is Channel 11 - 0x0B */
// Channels are defined in the following:
// 0 : 868 MHz 0x00000001
// 1 - 10 : 915 MHz 0x000007FE
// 11 - 26 : 2.4 GHz 0x07FFF800
//
//-DMAX_CHANNELS_868MHZ 0x00000001
//-DMAX_CHANNELS_915MHZ 0x000007FE
//-DMAX_CHANNELS_24GHZ 0x07FFF800
//-DDEFAULT_CHANLIST=0x04000000 // 26 - 0x1A
//-DDEFAULT_CHANLIST=0x02000000 // 25 - 0x19
//-DDEFAULT_CHANLIST=0x01000000 // 24 - 0x18
//-DDEFAULT_CHANLIST=0x00800000 // 23 - 0x17
//-DDEFAULT_CHANLIST=0x00400000 // 22 - 0x16
//-DDEFAULT_CHANLIST=0x00200000 // 21 - 0x15
//-DDEFAULT_CHANLIST=0x00100000 // 20 - 0x14
//-DDEFAULT_CHANLIST=0x00080000 // 19 - 0x13
//-DDEFAULT_CHANLIST=0x00040000 // 18 - 0x12
//-DDEFAULT_CHANLIST=0x00020000 // 17 - 0x11
//-DDEFAULT_CHANLIST=0x00010000 // 16 - 0x10
//-DDEFAULT_CHANLIST=0x00008000 // 15 - 0x0F
//-DDEFAULT_CHANLIST=0x00004000 // 14 - 0x0E
//-DDEFAULT_CHANLIST=0x00002000 // 13 - 0x0D
//-DDEFAULT_CHANLIST=0x00001000 // 12 - 0x0C
-DDEFAULT_CHANLIST=0x00000800 // 11 - 0x0B
/* Define the default PAN ID.
*
* Setting this to a value other than 0xFFFF causes
* ZDO_COORD to use this value as its PAN ID and
* Routers and end devices to join PAN with this ID
*/
-DZDAPP_CONFIG_PAN_ID=0xFFFF
/* Minimum number of milliseconds to hold off the start of the device
* in the network and the minimum delay between joining cycles.
*/
-DNWK_START_DELAY=100
/* Mask for the random joining delay. This value is masked with
* the return from osal_rand() to get a random delay time for
* each joining cycle. This random value is added to NWK_START_DELAY.
* For example, a value of 0x007F will be a joining delay of 0 to 127
* milliseconds.
*/
-DEXTENDED_JOINING_RANDOM_MASK=0x007F
/* Minimum number of milliseconds to delay between each beacon request
* in a joining cycle.
*/
-DBEACON_REQUEST_DELAY=100
/* Mask for the random beacon request delay. This value is masked with the
* return from osal_rand() to get a random delay time for each joining cycle.
* This random value is added to DBEACON_REQUEST_DELAY. For example, a value
* of 0x00FF will be a beacon request delay of 0 to 255 milliseconds.
*/
-DBEACON_REQ_DELAY_MASK=0x00FF
/* Jitter mask for the link status report timer. This value is masked with the
* return from osal_rand() to add a random delay to _NIB.nwkLinkStatusPeriod.
* For example, a value of 0x007F allows a jitter between 0-127 milliseconds.
*/
-DLINK_STATUS_JITTER_MASK=0x007F
/* in seconds; set to 0 to turn off route expiry */
-DROUTE_EXPIRY_TIME=30
/* This number is used by polled devices, since the spec'd formula
* doesn't work for sleeping end devices. For non-polled devices,
* a formula is used. Value is in 2 milliseconds periods
*/
-DAPSC_ACK_WAIT_DURATION_POLLED=3000
/* Default indirect message holding timeout value:
* 1-65535 (0 -> 65536) X CNT_RTG_TIMER X RTG_TIMER_INTERVAL
*/
-DNWK_INDIRECT_MSG_TIMEOUT=7
/* The number of simultaneous route discoveries in network */
-DMAX_RREQ_ENTRIES=8
/* The maximum number of retries allowed after a transmission failure */
-DAPSC_MAX_FRAME_RETRIES=3
/* Max number of times retry looking for the next hop address of a message */
-DNWK_MAX_DATA_RETRIES=2
/* Number of times retry to poll parent before indicating loss of synchronization
* with parent. Note that larger value will cause longer delay for the child to
* rejoin the network.
*/
-DMAX_POLL_FAILURE_RETRIES=2
/* The number of items in the broadcast table */
-DMAX_BCAST=9
/* The maximum number of groups in the groups table */
-DAPS_MAX_GROUPS=16
/* Number of entries in the regular routing table plus additional
* entries for route repair
*/
-DMAX_RTG_ENTRIES=40
/* Maximum number of entries in the Binding table. */
-DNWK_MAX_BINDING_ENTRIES=4
/* Maximum number of cluster IDs for each binding table entry.
* Note that any value other than the default value may cause a
* compilation warning but Device Binding will function correctly.
*/
-DMAX_BINDING_CLUSTER_IDS=4
/* Default security key. */
-DDEFAULT_KEY="{0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04}"
//-DDEFAULT_KEY="{0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D}"
/* Reset when ASSERT occurs, otherwise flash LEDs */
//-DASSERT_RESET
/* Set the MAC MAX Frame Size (802.15.4 default is 102) */
-DMAC_MAX_FRAME_SIZE=116
/* Minimum transmissions attempted for Channel Interference detection,
* Frequency Agility can be disabled by setting this parameter to zero.
*/
-DZDNWKMGR_MIN_TRANSMISSIONS=20
/* Compiler keywords */
-DCONST="const __code"
-DGENERIC=__generic
/****************************************
* The following are for End Devices only
***************************************/
-DRFD_RCVC_ALWAYS_ON=TRUE
/* The number of milliseconds to wait between data request polls to the coordinator. */
-DPOLL_RATE=1000
/* This is used after receiving a data indication to poll immediately
* for queued messages...in milliseconds.
*/
-DQUEUED_POLL_RATE=100
/* This is used after receiving a data confirmation to poll immediately
* for response messages...in milliseconds
*/
-DRESPONSE_POLL_RATE=100
/* This is used as an alternate response poll rate only for rejoin request.
* This rate is determined by the response time of the parent that the device
* is trying to join.
*/
-DREJOIN_POLL_RATE=440
/* Common To All Applications */
-DCPU32MHZ // CC2530s Run at 32MHz
-DROOT=__near_func // MAC/ZMAC code in NEAR
/* MAC Settings */
-DMAC_CFG_APP_PENDING_QUEUE=TRUE
-DMAC_CFG_TX_DATA_MAX=5
-DMAC_CFG_TX_MAX=8
-DMAC_CFG_RX_MAX=5
/* Coordinator Settings */
-DZDO_COORDINATOR // Coordinator Functions
-DRTR_NWK // Router Functions
您现在的网络拓扑是MESH网络?
若是设备反复入网,重新分配ShorAddr,AssociatedDevList就被占满了。建议删除AssociatedDevList中的无效节点
协调器配置打开了/* Enable ZigBee-Pro */ -DZIGBEEPRO,使用的MESH网络。
但是这个不涉及到反复入网呀。所有的节点都是重新烧录,协调器按键打开网络。
1 节点超过30个,就只能组网7个,而且发现AssociatedDevList会被占满。
2 节点少于30个,可以一次性组网成功。
我不知道你说的设备反复入网是指什么含义?(这边的话,设备根本就没有组网成功。)
Susan,怎么让协调器定期查看Assolist,然后删除无效的节点信息啊
关联表的删除可以用 AssocList.h 文件中的函数,也可以直接在 NV区中删除
AssocList.h 文件中的函数部分代码如下:
AddrMgrEntry_t addrEntry;
NLME_LeaveReq_t req;
uint8 i = Z_EXTADDR_LEN + 1;
// Set up device info
addrEntry.user = ADDRMGR_USER_DEFAULT;
addrEntry.index = index;
if (AddrMgrEntryGet( &addrEntry ))
{
for (i = 0; i < Z_EXTADDR_LEN; i++ )
{
if ( addrEntry.extAddr != 0 ){ break;}
}
}
if(i < Z_EXTADDR_LEN){
// Remove device
req.extAddr = addrEntry.extAddr;
req.removeChildren = TRUE;
req.rejoin = TRUE;
req.silent = FALSE;
NLME_LeaveReq( &req );
}else{
AssocRemove(addrEntry.extAddr);
ZDApp_NVUpdate();
}
另外较新版本的协议栈内加入了CHILD AGING功能,您可以点击以下链接获取详细说明:
http://www.deyisupport.com/question_answer/wireless_connectivity/zigbee/f/104/t/59370.aspx
希望对您有所帮助,谢谢!
好的 谢谢Susan
这个是很正常的,在AssociatedDevList中,节点反复rejoin就有可能造成关联表被塞满,最后在节点进行associate request的时候,无法给节点分配内存空间,而导致无法响应associate request的请求,最终的现象就是节点一直在beacon request。
所以,实际的使用中要考虑到对关联表的维护,有两种办法,
第一种、就是通过ZStack官方的那个child age的管理,官方提供的肯定方便嘛,不过我自己觉得有点麻烦。
第二种、自己手动去管理AssociatedDevList。具体如上。
不过这里带来了一个新的问题,你要自己去实现整个子节点在线与否的管理,在这里,我通过对AssociatedDevList的深入了解和实验后,自己做了一个节点在线维护和管理的模块,可以自己维护在线节点,并且及时清除不在线的节点,防止AssociatedDevList被撑爆而导致正常的节点无法加入的情况。具体的可以参考这篇帖子:
http://www.kaleidscope.cn:1020/archives/2715
我写的这个模块,只需要额外占用协议栈2个字节,即可进行所有的子节点的管理。
你的小站得翻墙才能打开吗
不需要翻墙,可能由于公网IP变化,DDNS解析到各个服务器需要时间,偶尔会出现这种情况。过一会儿就好了,已经可以正常访问了。
谢谢支持。