openthread / wpantund

Wireless Network Interface Daemon for Low-Power Wireless SoCs
Apache License 2.0
174 stars 110 forks source link

Unexpected reset on connected board #509

Closed KenMacD closed 1 year ago

KenMacD commented 2 years ago

When I connect an nrf52 board running the NCP coprocessor example it doesn't work unless I first connect to the board using spinel-cli.py. I get the following debug messages:

Starting wpantund 0.08.00d (Jan  1 1980 00:00:00) . . .Reading configuration from ".../etc/wpantund.conf" . . .Configuration file ".../etc/wpantund.conf" read.
set-config-param: "Config:NCP:SocketPath" = "/dev/ttyACM0"
Stat (autolog): Tx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
Stat (autolog): Tx history is empty
Stat (autolog):
Stat (autolog): Rx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
Stat (autolog): Rx history is empty
Stat (autolog):
Stat (autolog): NCP state history is empty.
Stat (autolog):
Stat (autolog):
Setting baud rate to 115200
Opening tun interface socket with name "wpan0"
Getting DBus connection
Registering DBus connection
Requesting DBus connection name com.nestlabs.WPANTunnelDriver
Ready. Using DBUS bus ":1.221"
Running as root without dropping privileges!
Initializing NCP
Removing all NCP originated addresses
NCP is now BUSY.
[->NCP] (1) PROP_VALUE_GET(PROTOCOL_VERSION)
[NCP->] (0) PROP_VALUE_IS(LAST_STATUS) [70]
[-NCP-]: Last status (RESET_POWER_ON, 112)
[-NCP-]: NCP was reset (RESET_POWER_ON, 112)
Unexpected reset during NCP initialization.
Initializing NCP
Removing all NCP originated addresses
[NCP->] (1) PROP_VALUE_IS(PROTOCOL_VERSION) [0403]
Resetting and trying again... (retry 1)
[->NCP] (2) RESET
[-NCP-]: Socket error on read: Broken pipe 32
NCPInstance: errno 11 "Resource temporarily unavailable"
Cleaning up. (gRet = 9)
Stopped.

It seems the daemon is confused by the power on status. It then issues a reset which results in the socket path disappearing.

This was tested using:

daniel-nicolai-hansten commented 1 year ago

I managed to solve the same issue with enabling udev support when building wpantund. See PR #492