微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > 使用ZDP_BindReq的问题

使用ZDP_BindReq的问题

时间:10-02 整理:3721RD 点击:

协调器a.节点b/c都预编译REFLECTOR,都开启了  #define ZDO_BIND_UNBIND_REQUEST

协调器a,向节点b发送ZDP_BindReq,节点b收到请求并进入到

#if defined ( REFLECTOR )
case Bind_req:
case Unbind_req:
{
ZDO_BindUnbindReq_t bindReq;
ZDO_ParseBindUnbindReq( inMsg, &bindReq );
ZDO_ProcessBindUnbindReq( inMsg, &bindReq );
}
break;

然后ZDO_ProcessBindUnbindReq( inMsg, &bindReq )里面

if ( APSME_BindRequest( pReq->srcEndpoint, pReq->clusterID,
&(pReq->dstAddress), pReq->dstEndpoint ) == ZSuccess )
{
uint16 nwkAddr;

// valid entry
bindStat = ZDP_SUCCESS;

// Notify to save info into NV
ZDApp_NVUpdate();

// Check for the destination address
if ( pReq->dstAddress.addrMode == Addr64Bit )
{
//osal_cpyExtAddr(RouterC,pReq->dstAddress.addr.extAddr);
if ( APSME_LookupNwkAddr( pReq->dstAddress.addr.extAddr, &nwkAddr ) == FALSE )
{
ZDP_NwkAddrReq( pReq->dstAddress.addr.extAddr, ZDP_ADDR_REQTYPE_SINGLE, 0, 0 );
}
}
}

第一次显示是进入到ZDP_NwkAddrReq命令,然后发送信息给节点c,节点c回一个rsp信号后返回到b。(这里是否已经确认绑定成功?)

节点b、c中的简单描述符

const cId_t SampleApp_ClusterList[SAMPLEAPP_MAX_CLUSTERS] =
{
SAMPLEAPP_PERIODIC_CLUSTERID,
SAMPLEAPP_FLASH_CLUSTERID
};

const SimpleDescriptionFormat_t SampleApp_SimpleDesc =
{
SAMPLEAPP_ENDPOINT, // int Endpoint;
SAMPLEAPP_PROFID, // uint16 AppProfId[2];
SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2];
SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4;
SAMPLEAPP_FLAGS, // int AppFlags:4;
SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;
(cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList;
SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumoutClusters;
(cId_t *)SampleApp_ClusterList // uint8 *pAppoutClusterList;
};

发送配置

SampleApp_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
SampleApp_Periodic_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;
SampleApp_Periodic_DstAddr.addr.shortAddr= 0xfffe;
if ( AF_DataRequest( &SampleApp_Periodic_DstAddr, &SampleApp_epDesc,
SAMPLEAPP_COM_CLUSTERID,//自己定义一个
len, 
num,
&SampleApp_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
}

但是c还是收不到b发的信息,请问问题出自哪里?

a在b发送ZDP_BindReq的时候,需要把对方的cluster, endpoint,IEEE地址都要告诉b,这个对吗?

然后b去找C的网络地址,

最后b会回复bind的status给到a。

SampleApp_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
SampleApp_Periodic_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;//这个endpoint应该是C的
SampleApp_Periodic_DstAddr.addr.shortAddr= 0xfffe;
if ( AF_DataRequest( &SampleApp_Periodic_DstAddr, &SampleApp_epDesc,
SAMPLEAPP_COM_CLUSTERID,//自己定义一个
len, 
num,
&SampleApp_TransID, 
AF_DISCV_ROUTE, 
AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
}

b跟c的endPoint 即SAMPLEAPP_ENDPOINT设置成20 

b回复a的status是到了a中的

case Bind_rsp:
if ( ZDO_ParseBindRsp( inMsg ) == ZSuccess )
{
// Light LED
HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
HalLcdWriteString("Bind establish",HAL_LCD_LINE_3);
}
break;

进入到该函数

ZDP_BindReq的值设置了 

dstAddr:b的短地址26d3

SourceAddr:b的长地址aa01e90a004b1200

SrcEP:b的SAMPLEAPP_ENDPOINT=20

ClusterID:0003 (此处的id我是自己定义的,但是值是跟简单描述符中SampleApp_ClusterList里面的某成员的值一样)

devAddr:c的长地址a0d7e80a004b1200

dstEPInt:c的SAMPLEAPP_ENDPOINT=20

SecurityEnable:0



调试b的时候 b是已经进入到ZDO_ProcessBindUnbindReq函数中,不过第一次发送绑定命令的时候是会进入到 APSME_LookupNwkAddr( pReq->dstAddress.addr.extAddr, &nwkAddr ) == FALSE的判断,同时c也收到一个数据(只在ZDApp_ProcessOSALMsg的接收中设置断点看到有AF的数据),第二次发送相同命令的时候,b不会进到APSME_LookupNwkAddr( pReq->dstAddress.addr.extAddr, &nwkAddr ) == FALSE的判断中,且c中ZDApp_ProcessOSALMsg也不会收到信息。(这应该是绑定成功了?)

是否需要b跟c的EP不一样?

还是我的流程有误?

vv你好,请再指引一下

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top