请教:Z-Stack3.0.2 ZNP的应用

芯片型号:CC2530F256

协议栈:Z-Stack3.0.2

测试:通过Z-TOOL2.0

Start Time: 2019/9/4 2:16:49

*** WARNING ***
Expected Z-Stack version (2.7.1) does not match with actual Z-Stack version (2.7.2). Z-Tool may not work properly.

<TX>02:18:31.78 COM1 SYS_OSAL_NV_WRITE (0x2109)
Id: 0x0003
Offset: 0x00
Len: 0x01
Value: . (0x03)

<RX>02:18:31.81 COM1 SYS_OSAL_NV_WRITE_SRSP (0x6109)
Status: SUCCESS (0x0)

<TX>02:18:57.53 COM1 SYS_RESET (0x4100)
Type: 0x00 (HARD RESET) (0x0)

<RX>02:19:00.64 COM1 SYS_RESET_RESPONSE (0x4180)
Reason: 0x02
TransportRev: 0x02
Product: 0x00
MajorRel: 0x02
MinorRel: 0x07
HwRev: 0x02

<TX>02:21:17.02 COM1 SYS_OSAL_NV_WRITE (0x2109)
Id: 0x0057
Offset: 0x00
Len: 0x01
Value: . (0x00)

<RX>02:21:17.06 COM1 SYS_OSAL_NV_WRITE_SRSP (0x6109)
Status: INVALID_PARAMETER (0x2)

<TX>02:35:40.69 COM1 SYS_OSAL_NV_WRITE (0x2109)
Id: 0x0057
Offset: 0x00
Len: 0x01
Value: . (0x00)

<RX>02:35:40.73 COM1 SYS_OSAL_NV_WRITE_SRSP (0x6109)
Status: INVALID_PARAMETER (0x2)

<TX>02:39:32.9 COM1 APP_CNF_BDB_START_COMMISSIONING (0x2F05)
CommissioningMode: (0x04) Network Formation (0x4)

<RX>02:39:39.26 COM1 APP_CNF_BDB_START_COMMISSIONING_SRSP (0x6F05)
Status: SUCCESS (0x0)

<RX>02:39:39.26 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:39.27 COM1 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
Status: 1 (0x1)
Commissioning Mode: 0x02 (Formation) (0x2)
Commissioning Mode: 0x04 (Network Formation) (0x4)

<RX>02:39:39.53 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:39.79 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:40.06 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:40.32 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:40.59 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 8 (0x8)

<RX>02:39:41.15 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
State: 9 (0x9)

<RX>02:39:41.15 COM1 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
Status: 0x00 (Success) (0x0)
Commissioning Mode: 0x02 (Formation) (0x2)
Commissioning Mode: 0 (0x0)

<TX>02:40:35.8 COM1 UTIL_GET_DEVICE_INFO (0x2700)

<RX>02:40:35.81 COM1 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
Status: SUCCESS (0x0)
IEEEAddr: 0x00124B0007665581
ShortAddress: 0x0000
DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)
DeviceState: DEV_ZB_COORD (0x9)
NumAssocDevices: 0x00
AssocDevicesList

做了以上操作,也可以获取设备信息

看论坛帖子说下来该注册端点和发送数据。问题如下:

1、端点注册AF_REGISTER

EndPoint: 
AppProfID: 
AppDeviceId: 
AppDevVer: 
LatencyReq: 
AppNumInClusters:
AppInClusterList: 
AppNumOutClusters: 
AppOutClusterList: 

2、AF_DATA_REQUEST (0x2401)

DstAddr: 
DestEndpoint: 
SrcEndpoint: 
ClusterID: 
TransID: 
Options: 
Radius: 
Len: 
Data: 

以上参数怎么获取?该怎么填,有那些资料可以参考?

3、终端用的是Z-Stack 3.0.2  SampleLight例程,把控制回路增加到三路,目前用SampleSwitch作协调器

可以控制其中的一路,若用ZNP协调器控制是不是要注册三个端点?谢谢!

31 个回复

  • 1. 可以參考SampleSwitch例程裡面的zclSampleSw_SimpleDesc是怎麼填的
    2. 可以參考SampleSwitch例程裡面的zclGeneral_SendOnOff_CmdToggle是怎樣調用AF_DATA_REQUEST 並填入相關參數
    3. 是Z-Stack 3.0.2 SampleLight例程要注册三个端点,协调器只要針對不同的端点下命令就好

    YK Chen

  • 回复 YiKai Chen:

    您好!谢谢您的指导和回复,但是目前还有问题,估计是数据或端点错误,但不知道哪部分出了问题,请多指教!抓图如下:

    抓包文件:0906_Test.rar

    另外有几个问题请教:

    1、昨天终端是可以入网的,今天就不行了,后来重新烧写程序,以后每次都要这样么?

    2、想用CC2530ZNP+MCU的方式来实现网关这种方案可行不?有没参考代码?

    谢谢!

  • 回复 user5228474:

    你SrcEndpoint 為什麼是0xFE?你用AF_REGISTER時用的是0x07不是嗎?

    另外

    1. 如果你使能NV_RESTORE照理不需每次重新入網

    2. 可以參考

    YK Chen

  • 回复 YiKai Chen:

    您好!首先感谢您的回复和帮助,目前注册端点、发送数据在Z-TOOl客户端都能看到成功,但是发送数据终端的LED没变化,抓包也看不到开关数据,截图

    及数据包如下:

    数据包:0906_Test2.rar

    再次谢谢您的指导和帮助!

  • 回复 user5228474:

    你用AF_REGISTER時用的是0x07, 發送命令的SrcEndpoint要用0x07,目的是SampleLight 的Endpoint 是0x08,所以DstEndpoint 該用0x08

    YK Chen

  • 回复 YiKai Chen:

    您好!十分感谢您的指导帮助和快速回复!我刚刚试了下:

    若:SrcEndpoint: 0x07   

          DestEndpoint:= 0x08或者0x9

    会在客户端显示发送不成功,另外我把三个端点都分别注册了。图截如下:

    再次感谢您的指导帮助!

  • 回复 user5228474:

    請附上抓包檔,抓包要包含入網過程

    YK Chen

  • 回复 YiKai Chen:

    你好!十分感谢您的帮助、指导和回复!刚刚抓了从入网开始的数据包这次的数据包里有“格式错误的

    数据包”提示,下午测试时也出现过一次,由于发帖失误没上来,数据包见附件,Z-Tool收发数据如下:

    <TX>11:48:35.84 COM1 UTIL_GET_DEVICE_INFO (0x2700)

    <RX>11:48:35.86 COM1 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)

       Status: SUCCESS (0x0)

       IEEEAddr: 0x00124B0007665581

       ShortAddress: 0x0000

       DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)

       DeviceState: DEV_ZB_COORD (0x9)

       NumAssocDevices: 0x01

       AssocDevicesList: 0x3B3B

    <TX>11:49:56.75 COM1 AF_REGISTER (0x2400)

       EndPoint: 0x07

       AppProfID: 0x0104

       AppDeviceId: 0x0103

       AppDevVer: 0x01

       LatencyReq: NO_LATENCY_REQS (0x0)

       AppNumInClusters: 0x03

       AppInClusterList: 0x0000, 0x0003, 0x0007

       AppNumOutClusters: 0x03

       AppOutClusterList: 0x0003, 0x0006, 0x0004

    <RX>11:49:56.76 COM1 AF_REGISTER_SRSP (0x6400)

       Status: afStatus_SUCCESS (0x0)

    <TX>11:50:02.85 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x07

       SrcEndpoint: 0x07

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:50:02.85 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

    <RX>11:50:03.78 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x07

       TransID: 0xFF

    <TX>11:50:21.32 COM1 AF_REGISTER (0x2400)

       EndPoint: 0x08

       AppProfID: 0x0104

       AppDeviceId: 0x0103

       AppDevVer: 0x01

       LatencyReq: NO_LATENCY_REQS (0x0)

       AppNumInClusters: 0x03

       AppInClusterList: 0x0000, 0x0003, 0x0007

       AppNumOutClusters: 0x03

       AppOutClusterList: 0x0003, 0x0006, 0x0004

    <RX>11:50:21.32 COM1 AF_REGISTER_SRSP (0x6400)

       Status: afStatus_SUCCESS (0x0)

    <TX>11:50:29.72 COM1 AF_REGISTER (0x2400)

       EndPoint: 0x09

       AppProfID: 0x0104

       AppDeviceId: 0x0103

       AppDevVer: 0x01

       LatencyReq: NO_LATENCY_REQS (0x0)

       AppNumInClusters: 0x03

       AppInClusterList: 0x0000, 0x0003, 0x0007

       AppNumOutClusters: 0x03

       AppOutClusterList: 0x0003, 0x0006, 0x0004

    <RX>11:50:29.73 COM1 AF_REGISTER_SRSP (0x6400)

       Status: afStatus_SUCCESS (0x0)

    <TX>11:50:38.12 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x08

       SrcEndpoint: 0x07

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:50:38.13 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

    <RX>11:50:39.07 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x07

       TransID: 0xFF

    <TX>11:50:49 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x09

       SrcEndpoint: 0x07

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:50:49.01 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

    <RX>11:50:49.24 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x07

       TransID: 0xFF

    <TX>11:50:58.06 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x09

       SrcEndpoint: 0x09

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:50:58.07 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

    <RX>11:50:58.41 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x09

       TransID: 0xFF

    <TX>11:51:09.91 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x08

       SrcEndpoint: 0x08

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:51:09.92 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

     

    <RX>11:51:10.58 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x08

       TransID: 0xFF

    <TX>11:51:35 COM1 AF_DATA_REQUEST (0x2401)

       DstAddr: 0x3B3B

       DestEndpoint: 0x07

       SrcEndpoint: 0x07

       ClusterID: 0x0006

       TransID: 0xFF

       Options: 0x10

       Radius: 0x1E

       Len: 0x01

       Data: . (0x02)

    <RX>11:51:35.01 COM1 AF_DATA_REQUEST_SRSP (0x6401)

       Status: afStatus_SUCCESS (0x0)

    <RX>11:51:35.81 COM1 AF_DATA_CONFIRM (0x4480)

       Status: afStatus_SUCCESS (0x0)

       Endpoint: 0x07

       TransID: 0xFF

    0906_Test_3.rar

    再次感谢!谢谢!

  • 回复 user5228474:

    試試

    <TX>09:50:34.49 COM4 AF_DATA_REQUEST (0x2401)
    DstAddr: xxxx
    DestEndpoint: 0xxx
    SrcEndpoint: 0xxx
    ClusterID: 0x0006
    TransID: 0x00
    Options: 0x00
    Radius: 0x00
    Len: 0x03
    Data: ... (0x01, 0x01, 0x02)

    YK Chen