微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > Z-Stack Linux Gateway在Mips平台下运行问题

Z-Stack Linux Gateway在Mips平台下运行问题

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

运行环境:MCU使用MT7628,ZigBee协调器使用CC2530,两者通过Uart通信。

协调器CC2530使用的程序时ZigBee 3.0提供的ZNP工程Demo。

把Z-Stack Linux Gateway移植到MT7628 Mips平台上,得到Z-Stack Gateway的Server程序如下:

NPI_lnx_mips_server、ZLSZNP_mips、NWKMGR_SRVR_mips、GATEWAY_SRVR_mips、OTA_SRVR_mips。

按照顺序执行了NPI_lnx_mips_server、ZLSZNP_mips,当执行NWKMGR_SRVR_mips程序时发生初始化错误,执行Log如下所示:

# ./NWKMGR_SRVR_mips 127.0.0.1:2536

[NWK_MGR/MAIN] :  there are 2 args

[NWK_MGR/MAIN] :  argv[0] = ./NWKMGR_SRVR_mips

[NWK_MGR/MAIN] :  argv[1] = 127.0.0.1:2536

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb zspbHandlePbCb - connected: 7

[NWK_MGR/MAIN] :  ************************************************

[NWK_MGR/MAIN] :  *         Network Manager Server v1.0.1        *

[NWK_MGR/MAIN] :  * The following are the avaible key commands:  *

[NWK_MGR/MAIN] :  * Exit Program.                         -  q   *

[NWK_MGR/MAIN] :  ************************************************

 

Sending AF Register Request.

[NWK_MGR/MAIN] INFO: preparing to send 21 bytes, subSys 0x11, cmdId 0x20, pData:

[NWK_MGR/MAIN] INFO:  0x08

[NWK_MGR/MAIN] INFO:  0x20

[NWK_MGR/MAIN] INFO:  0x10

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x1A

[NWK_MGR/MAIN] INFO:  0x0D

[NWK_MGR/MAIN] INFO:  0x08

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x10

[NWK_MGR/MAIN] INFO:  0x84

[NWK_MGR/MAIN] INFO:  0x02

[NWK_MGR/MAIN] INFO:  0x18

[NWK_MGR/MAIN] INFO:  0x07

[NWK_MGR/MAIN] INFO:  0x20

[NWK_MGR/MAIN] INFO:  0x00

[NWK_MGR/MAIN] INFO:  0x28

[NWK_MGR/MAIN] INFO:  0x00

[NWK_MGR/MAIN] INFO:  0x30

[NWK_MGR/MAIN] INFO:  0x06

[NWK_MGR/MAIN] INFO:  0x20

[NWK_MGR/MAIN] INFO:  0x00

[NWK_MGR/MAIN] INFO: [MUTEX] Lock SRSP Mutex[NWK_MGR/MAIN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Receive message...

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb zspbHandlePbCb: subsystemID:31, cmdId:20

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb afRegister: profileID:104

[ZSTACKZNP_SRVR/LSTN] INFO: znp_misc sendNPIExpectDefaultStatusZNP: subSys:4, cmdID:0, len:13

[ZSTACKZNP_SRVR/LSTN] INFO: preparing to send 13 bytes, subSys 0x04, cmdId 0x00, pData:

[ZSTACKZNP_SRVR/LSTN] INFO:  0x01

[ZSTACKZNP_SRVR/LSTN] INFO:  0x04

[ZSTACKZNP_SRVR/LSTN] INFO:  0x01

[ZSTACKZNP_SRVR/LSTN] INFO:  0x07

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x01

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x01

[ZSTACKZNP_SRVR/LSTN] INFO:  0x06

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Lock SRSP Mutex[ZSTACKZNP_SRVR/LSTN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Waiting for synchronous response...

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Wait for SRSP Cond signal...

[NWK_MGR/MAIN] INFO: Waiting for synchronous response...

[NWK_MGR/MAIN] INFO: [MUTEX] Wait for SRSP Cond signal...

[NWK_MGR/HNDL] INFO: [MUTEX] Wait for AREQ semaphore

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] SRSP Cond Wait timed out!

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Unlock SRSP Mutex

[ZSTACKZNP_SRVR/LSTN] INFO: ...sent 8 bytes to Client

[ZSTACKZNP_SRVR/LSTN] INFO: !Done

[NWK_MGR/READ] INFO: Received 4 bytes,   subSys 0x71, cmdId 0x20, pData:

[NWK_MGR/READ] INFO:  0x8

[NWK_MGR/READ] INFO:  0x20

[NWK_MGR/READ] INFO:  0x10

[NWK_MGR/READ] INFO:  0x0

[NWK_MGR/READ] INFO: [MUTEX] SRSP Cond signal set

[NWK_MGR/READ] INFO: Client Read: (len 0): [NWK_MGR/MAIN] INFO: 0x08

[NWK_MGR/MAIN] INFO: 0x20

[NWK_MGR/MAIN] INFO: 0x10

[NWK_MGR/MAIN] INFO: 0x00

[NWK_MGR/MAIN] INFO: [MUTEX] Unlock SRSP Mutex

AF Register Request Successful

[NWK_MGR/MAIN] INFO: preparing to send 90 bytes, subSys 0x11, cmdId 0x14, pData:

[NWK_MGR/MAIN] INFO:  0x08

[NWK_MGR/MAIN] INFO:  0x14

[NWK_MGR/MAIN] INFO:  0x10

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x18

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x20

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x28

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x30

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x38

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x40

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x48

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x50

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x58

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x60

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x68

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x70

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x78

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x80

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x88

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x90

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x98

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xA0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xA8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xB0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xB8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xC0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xC8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xD0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xD8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xE0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xE8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xF0

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xF8

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x80

[NWK_MGR/MAIN] INFO:  0x02

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x88

[NWK_MGR/MAIN] INFO:  0x02

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0x90

[NWK_MGR/MAIN] INFO:  0x02

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO:  0xA0

[NWK_MGR/MAIN] INFO:  0x02

[NWK_MGR/MAIN] INFO:  0x01

[NWK_MGR/MAIN] INFO: [MUTEX] Lock SRSP Mutex[NWK_MGR/MAIN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Receive message...

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb zspbHandlePbCb: subsystemID:31, cmdId:14

[ZSTACKZNP_SRVR/LSTN] INFO: ...sent 8 bytes to Client

[ZSTACKZNP_SRVR/LSTN] INFO: !Done

[NWK_MGR/READ] INFO: Received 4 bytes,   subSys 0x71, cmdId 0x14, pData:

[NWK_MGR/READ] INFO:  0x8

[NWK_MGR/READ] INFO:  0x14

[NWK_MGR/READ] INFO:  0x10

[NWK_MGR/READ] INFO:  0x0

[NWK_MGR/READ] INFO: [MUTEX] SRSP Cond signal set

[NWK_MGR/READ] INFO: Client Read: (len 0): [NWK_MGR/MAIN] INFO: Waiting for synchronous response...

[NWK_MGR/MAIN] INFO: [MUTEX] Wait for SRSP Cond signal...

[NWK_MGR/MAIN] INFO: 0x08

[NWK_MGR/MAIN] INFO: 0x14

[NWK_MGR/MAIN] INFO: 0x10

[NWK_MGR/MAIN] INFO: 0x00

[NWK_MGR/MAIN] INFO: [MUTEX] Unlock SRSP Mutex

ZDO Callback Register Response Successful

NwkMgr sendSysNwkInfoReadReq:

[NWK_MGR/MAIN] INFO: preparing to send 2 bytes, subSys 0x11, cmdId 0x08, pData:

[NWK_MGR/MAIN] INFO:  0x08

[NWK_MGR/MAIN] INFO:  0x08

[NWK_MGR/MAIN] INFO: [MUTEX] Lock SRSP Mutex[NWK_MGR/MAIN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Receive message...

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb zspbHandlePbCb: subsystemID:31, cmdId:8

[ZSTACKZNP_SRVR/LSTN] INFO: preparing to send 0 bytes, subSys 0x05, cmdId 0x50, pData:

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Lock SRSP Mutex[ZSTACKZNP_SRVR/LSTN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Waiting for synchronous response...

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Wait for SRSP Cond signal...

[NWK_MGR/MAIN] INFO: Waiting for synchronous response...

[NWK_MGR/MAIN] INFO: [MUTEX] Wait for SRSP Cond signal...

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] SRSP Cond Wait timed out!

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Unlock SRSP Mutex

[ZSTACKZNP_SRVR/LSTN] INFO: zstackpb Sending Network Info Response

[ZSTACKZNP_SRVR/LSTN] INFO: znp_misc osal_nv_read: id:1, len:8

[ZSTACKZNP_SRVR/LSTN] INFO: preparing to send 3 bytes, subSys 0x01, cmdId 0x08, pData:

[ZSTACKZNP_SRVR/LSTN] INFO:  0x01

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO:  0x00

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Lock SRSP Mutex[ZSTACKZNP_SRVR/LSTN] INFO:

[MUTEX] SRSP Lock status: 0

[ZSTACKZNP_SRVR/LSTN] INFO: Waiting for synchronous response...

[ZSTACKZNP_SRVR/LSTN] INFO: [MUTEX] Wait for SRSP Cond signal...

[NWK_MGR/MAIN] INFO: [MUTEX] SRSP Cond Wait timed out!

[NWK_MGR/MAIN] INFO: [MUTEX] Unlock SRSP Mutex

[NWK_MGR/MAIN] ERROR: Reading Local Network Information Failed

[NWK_MGR/MAIN] : Initialization failed. Quitting now. mhoyt


网关和协调器的串口通信是没有问题的。请问这可能是由什么问题导致的?

谢谢!

目前的linux Gateway 的参考代码还不能直接和Z-Stack 3.0 ZNP使用,后续发布的版本才可以。

建议先使用Z-Stack Home 1.2.2a的ZNP

前段时间我也尝试调试过Linux gateway 配合Z-Stack 3.0 ZNP,结果总是莫名其表各种问题,基本上就是Gateway发过去的命令总是执行超时,用的也是UART口;

后来gateway代码过于复杂,又转向尝试znp-host-framework,发现同样也是很多问题,比如3.0 zigbee协议部分实现了bdb接口,3.0协议也推荐使用bdb实现设备的建网、配对等等,但是znp-host-framework仍然用的是ZDO部分的接口包括消息回调,仍然都是ZDO的接口。

至今也没有完全搞定ZNP和znp-host-framework之间的完全组网。

@hold li

请教一下,我的linux gateway移植到其他平台的时候,总是编译不过。

除了修改编译交叉环境变量和UART驱动部分代码后,还有哪些地方需要修改的?

我的实践已经证明,只要是ARM LINUX都可以编译过去的,Android下面也是linux,我在台湾一家公司的SOC上跑Linux已经成功编译了,不是AM335x的armv7,是armv5ejs,把编译错误贴上来看看

@xiaohui bu 参考我的帖子http://blog.csdn.net/code_style/article/details/54375494#comments

谢谢!目前gateway和znp通信正常了。

您好,

       我正在mips平台上移植TI CC2530, 目前有遇到在執行NWK Mgr 時,  NPI deamon收到unknown request 而發生error

       請問您有遇到過嗎? 

       謝謝!

# ./zigbeeHAgw mips

running zigbeegw.scr on an mips
done processing arguments, board type mips, target mips
NPI                 is 'NPI_lnx_mips_server'
Zstack linux server is 'ZLSZNP_mips'
gateway server      is 'GATEWAY_SRVR_mips'
network manager     is 'NWKMGR_SRVR_mips'
OTA server        is 'OTA_SRVR_mips'
making sure there are no lingering servers...
there are 0 NIP servers
there are 0 ZLS servers
there are 0 GATEWAY servers
there are 0 NWKMGR servers
there are 0 OTA servers
(total 0)
done
making sure there are no lingering servers...
there are 0 NIP servers
there are 0 ZLS servers
there are 0 GATEWAY servers
there are 0 NWKMGR servers
there are 0 OTA servers
(total 0)
done
skipping zigbee reset
Starting the ZigBee gateway subsystem
===================================================
starting NPI, cmd ' ./NPI_lnx_mips_server NPI_Gateway.cfg ' atThu Jan  1 08:01:10 GMT 1970
will delay 4 secs before starting Zstack
deviceKey = 0  (0 )
devPath = '/dev/ttyS1'
logPath = '/tmp/NpiLnxLog.txt'
... freeing memory (ret 0)
waiting for first connection on #4...
NPI started (pid 1339) at Thu Jan  1 08:01:14 GMT 1970
===================================================
starting ZLSZNP, cmd ' ' atThu Jan  1 08:01:14 GMT 1970
will delay 4 secs before starting GW
Trying to connect...
Connected to #6.
Connected.
Port: 166201832
Following IP addresses are available:

 IPv4: interface: lo     IP Address 127.0.0.1
 IPv4: interface: br0    IP Address 192.168.1.12
 IPv6: interface: lo     IP Address ::1
 IPv6: interface: eth0   IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: eth0.3         IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: eth0.5         IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: nas0   IP Address fe80::200:ff:fe01:2
 IPv6: interface: br0    IP Address fe80::1
 IPv6: interface: nas0_0         IP Address fe80::2e0:4cff:fe81:adc8
The socket will listen on the following IP addresses:

  IPv4: 0.0.0.0
  IPv6: ::
0.0.0.0 means it will listen to all available IP address

waiting for first connection on #6...
ZLSZNP started (pid 1345) at Thu Jan  1 08:01:19 GMT 1970
===================================================
starting NETWORK_MGR, cmd './NWKMGR_SRVR_mips 127.0.0.1:2536 ' at Thu Jan  1 08:01:19 GMT 1970
will delay 1 secs after starting netmgr
[NWK_MGR/MAIN] :  there are 2 args
[NWK_MGR/MAIN] :  argv[0] = ./NWKMGR_SRVR_mips
[NWK_MGR/MAIN] :  argv[1] = 127.0.0.1:2536
Trying to connect...
Connected to #7.
Connected.
Port: 2540
Following IP addresses are available:

 IPv4: interface: lo     IP Address 127.0.0.1
 IPv4: interface: br0    IP Address 192.168.1.12
 IPv6: interface: lo     IP Address ::1
 IPv6: interface: eth0   IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: eth0.3         IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: eth0.5         IP Address fe80::2e0:4cff:fe81:adc3
 IPv6: interface: nas0   IP Address fe80::200:ff:fe01:2
 IPv6: interface: br0    IP Address fe80::1
 IPv6: interface: nas0_0         IP Address fe80::2e0:4cff:fe81:adc8
The socket will listen on the following IP addresses:

  IPv4: 0.0.0.0
  IPv6: ::
0.0.0.0 means it will listen to all available IP address

waiting for first connection on #6...
[NWK_MGR/MAIN] :  ************************************************
[NWK_MGR/MAIN] :  *         Network Manager Server v1.0.1        *
[NWK_MGR/MAIN] :  * The following are the avaible key commands:  *
[NWK_MGR/MAIN] :  * Exit Program.                         -  q   *
[NWK_MGR/MAIN] :  ************************************************

[nmRegEndpoint][4493] len 21
Can only accept AREQ or SREQ for now...
Unknown: (len 24) 0x15 0x00 0x31 0x20 0x08 0x20 0x10 0x01 0x1A 0x0D 0x08 0x01 0x10 0x84 0x02 0x18 0x07 0x20 0x00 0x28 0x00 0x30 0x06 0x20
[ERR] npi_ipc_errno 0x01030400
Exit socket while loop
connect: No such file or directory
connect: No such file or directory
... freeing memory (ret 1)
recv: Connection reset by peer
NETWORK MANAGER started (pid 1352) at Thu Jan  1 08:01:20 GMT 1970

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

网站地图

Top