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.

AssociatedDevList表满后删除问题!

Other Parts Discussed in Thread: CC2530

芯片:cc2530

协议栈:ZStack-CC2530-2.5.1

现象:仿真器带coordinator,添加新router至coordinator的AssociatedDevList表满了,所有router断电,coordinator调用以下函数删表:

if ( AssociatedDevList[i].age > IN_CHILD_NODE_DEL_TIME ) //连续10分钟没有该节点消息,删除
{
          addrEntry.index = i;

         if ( AddrMgrEntryGet( &addrEntry ) )
         {
                 req.extAddr = addrEntry.extAddr;
                 //osal_memcpy(req.extAddr, addrEntry.extAddr, 8);
                 req.removeChildren = TRUE; //-true 子设备也脱离,false只脱离当前设备
                 req.rejoin = TRUE; //允许设备重新加入网络,false 不允许设备重新加入网络
                 req.silent = FALSE;

                  NLME_LeaveReq( &req );

                  AssocRemove(addrEntry.extAddr);
                  ZDApp_NVUpdate();

            }
}

发现有的AssociatedDevList表内的数据能清成0xff,有的不能,那几个库函数直接就仿真进汇编了,不清楚为什么清除不了,求解答?或者告诉从那查起?

  • AssocGetWithExt里面能查到对应的短地址么

  • 感谢W的回复

    再次仿真发现,AssociatedDevList的序号和AddrMgrEntryGet()函数赋值的序号不一致,不知道为什么?

    试验如下:

    for (i = 0; i < NWK_MAX_DEVICES; i++)      //从0开始删除
    {

             addrEntry.index = i;//此处把0序号给变量

            if ( AddrMgrEntryGet( &addrEntry ) )//此处查询到shortaddr,发现和AssociatedDevList[0]的shortaddr不一致,但是和AssociatedDevList[1]的shortaddr一致

            {

                       //上面问题给出的删除操作  //顺利删除了AssociatedDevList[1](**但是现在i=0,我想删除AssociatedDevList[0]**)

             }

    }

    然后又操作一次当i=1时读出的shortaddr是AssociatedDevList[3],造成最终我的AssociatedDevList删除不完全,不知错在哪?两个表的序号不应该一致么?

    另想采用回复的AssocGetWithExt查询shortaddr,但是在删除不掉的表中获取扩展地址时AddrMgrEntryGet返回为0,不返回扩展地址,即没有扩展地址也不能执行查询shortaddr了,也不清楚原因。

  • 谢谢W的提醒,我已找到问题,解决了故障。

    具体描述如下:未知原因DevList表和AddrMgr管理的表中的对应关系不以序号为对应关系,所以强制index时查不出正确的扩展地址,修改查询方式为shortaddr后,问题解决。