硬件:协调器:CC2652R1_LAUNCHXL, 节点: CC2530
软件:协调器:C:\ti\simplelink_cc13x2_26x2_sdk_3_30_00_03\examples\rtos\CC26X2R1_LAUNCHXL\zstack\zc_genericapp\tirtos\iar\zc_genericapp_CC26X2R1_LAUNCHXL_tirtos_iar.template.eww
Viki Shi:
如下这几个值建议关注一下:
• NWK_MAX_DEVICE_LIST
• MAX_NEIGHBOR_ENTRIES
• MAX_RTG_SRC_ENTRIES
• ZDSECMGR_TC_DEVICE_MAX另外TI的MTO方案可以参考一下:AN123 – Breaking the 400-Node ZigBee® Network Barrier With TI’s ZigBee SoC and Z-Stack™ Software
www.ti.com/…/swra427c.pdf
YiKai Chen:
cc2530的硬件資源受限,如果要连接50个节点建議用cc2652r1
user4203015:
回复 YiKai Chen:
协调器使用的是CC2652R1,节点用的CC2530
YiKai Chen:
回复 user4203015:
建議你用新的simplelink_cc13x2_26x2_sdk_3_40_00_02,透過sysconfig去設置這些參數後測試看看
user4203015:
回复 YiKai Chen:
调试发现,引起死机原因在函数ZDP_ParentAnnce中,当numberOfChildren >=10时,pBuf的地址会越界,ZDP_TmpBuf的大小默认的是80-1=79,详见代码中的中文注释,请问这是协议栈的BUG吗?
afStatus_t ZDP_ParentAnnce( uint8_t *TransSeq,zAddrType_t *dstAddr,uint8_t numberOfChildren,uint8_t *childInfo,cId_t clusterID,uint8_t SecurityEnable )
{uint8_t *pBuf = ZDP_TmpBuf;//pBuf 可用空间为79个字节ZDO_ChildInfo_t *pChildInfo;uint8_t i, len;uint8_t *numOfChild;
(void)SecurityEnable;// Intentionally unreferenced parameter
pChildInfo = (ZDO_ChildInfo_t *)childInfo;
if ( dstAddr->addrMode == AddrBroadcast ){// Make sure is sent to 0xFFFCdstAddr->addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVZCZR;}len = 1;if ( clusterID == Parent_annce_rsp ){// + Status Bytelen += 1;// Set the status bit to success*pBuf++ = 0;}
numOfChild = pBuf;*pBuf++ = numberOfChildren;//ZDP_TmpBuf可用空间减小到78个字节
for ( i = 0; i < MAX_PARENT_ANNCE_CHILD; i++ ){pBuf = osal_cpyExtAddr( pBuf, pChildInfo[childIndex].extAddr );//每复制一次需要8个字节,如果复制MAX_PARENT_ANNCE_CHILD=10个, //需要80个字节,会超出ZDP_TmpBuf可用的78字节,造成数组越界,导致 //异常childIndex++;
len += Z_EXTADDR_LEN;
if ( childIndex == numberOfChildren ){pBuf = numOfChild;*pBuf = i + 1;// All childs are taken, restart index and go outchildIndex = 0;return fillAndSend( TransSeq, dstAddr, clusterID, len );}}
pBuf = numOfChild;*pBuf = MAX_PARENT_ANNCE_CHILD;if ( childIndex < numberOfChildren ){if ( clusterID == Parent_annce ){ZDApp_SetParentAnnceTimer();}if ( clusterID == Parent_annce_rsp ){OsalPortTimers_startTimer( ZDAppTaskID, ZDO_PARENT_ANNCE_EVT, 10 );}}
return fillAndSend( TransSeq, dstAddr, clusterID, len );
}
YiKai Chen:
回复 user4203015:
這邊確實看起來怪怪的,試試把ZDP_BUF_SZ加大看看
YiKai Chen:
回复 user4203015:
我在英文論壇發了個文 e2e.ti.com/…/883867 跟美國的FAE確認這個問題,給你參考
user4203015:
回复 YiKai Chen:
将ZDP_BUF_SZ更改为90,MAX_PARENT_ANNCE_CHILD仍为10,数组没有越界,也没有出现报错了
Aries Lord:
回复 user4203015:
ZDP_BUF_SZ的最大应该设置为82字节,ZDP_ParentAnnce是广播发送的,只能广播发送一帧。
Parent_annce命令的帧载荷是一个字节ZDP Sequence,一个字节携带MAC地址个数,剩下80个字节刚好够10个MAC用。
而Parent_annce_rsp多携带一个status字节,因此只能剩下79个字节,不够10个MAC地址用。