Issue flashing and running openthread rcp example samples/net/openthread/coprocessor on Arduino Nano 33 BLE #nrf52480
nagesh.shamnur@...
Hi All,
Issue Description: I am trying to flash and run openthread rcp sample as explained in the link: https://docs.zephyrproject.org/latest/samples/net/openthread/coprocessor/README.html. I am able to flash the image successfully, but port for spinel to connect to board seems to be off and thus ot-daemon is failing since it cannot find the socket on which it exchanges the HDLC frames and thus ot-daemon init is failing.
With further analysis, i found that, the /dev/ttyACM0 is allocated for openthread coprocessor but that seems to get disconnected and then again /dev/ttyACM1 is created which apparently doesn't looks like belonging to RCP.
my config as below:
i am using boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig from upstream master without any changes.
but changing config under samples/net/openthread/coprocessor as below:
prj.conf: commented CONFIG_UART_CONSOLE_ON_DEV_NAME to avoid shell/console which might conflict with spinel.
added a new file overlay-usb-arduino-coprocessor.conf with values as below: (Without this overlay file, once flashed, /dev/ttyACMx was not showing up in dmesg and thus board was not accessible for spinel)
```
# Arduino NCP/RCP USB CDC-ACM
# Use USB-CDC-ACM for Co-Processor
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="OpenThread CoProcessor NRF"
CONFIG_USB_CDC_ACM=y
CONFIG_UART_LINE_CTRL=y
CONFIG_USB_REQUEST_BUFFER_SIZE=2048
CONFIG_ISR_STACK_SIZE=4096
## added for testing
CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
```
command to build and flash:
west build -p auto -b arduino_nano_33_ble samples/net/openthread/coprocessor -- -DCONF_FILE="prj.conf overlay-rcp.conf overlay-usb-arduino-rcp.conf"
west flash --bossac="path to arudino bossac"
once flashing is done, dmesg shows as below:
```
$ sudo dmesg
[92443.138797] usb 1-2: USB disconnect, device number 100
[92445.514950] usb 1-2: new full-speed USB device number 101 using xhci_hcd
[92445.668022] usb 1-2: New USB device found, idVendor=2341, idProduct=005a, bcdDevice= 0.11
[92445.668036] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92445.668042] usb 1-2: Product: Arduino Nano 33 BLE
[92445.668047] usb 1-2: Manufacturer: Arduino
[92445.668051] usb 1-2: SerialNumber: 0000000000000000768275C7726D618B
[92445.671199] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[92445.750532] usb 1-2: USB disconnect, device number 101
[92446.058962] usb 1-2: new full-speed USB device number 102 using xhci_hcd
[92446.210705] usb 1-2: New USB device found, idVendor=2fe3, idProduct=0100, bcdDevice= 2.06
[92446.210718] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92446.210724] usb 1-2: Product: OpenThread CoProcessor NRF
[92446.210729] usb 1-2: Manufacturer: ZEPHYR
[92446.210733] usb 1-2: SerialNumber: 53235D59E996F2DD
[92446.213710] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[92446.965464] usb 1-2: USB disconnect, device number 102
[92447.286888] usb 1-2: new full-speed USB device number 103 using xhci_hcd
[92447.437855] usb 1-2: New USB device found, idVendor=2341, idProduct=005a, bcdDevice= 0.11
[92447.437858] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92447.437859] usb 1-2: Product: Arduino Nano 33 BLE
[92447.437860] usb 1-2: Manufacturer: Arduino
[92447.437861] usb 1-2: SerialNumber: 0000000000000000768275C7726D618B
[92447.440050] cdc_acm 1-2:1.0: ttyACM1: USB ACM device
[92447.476098] usb 1-2: USB disconnect, device number 103
[92447.786887] usb 1-2: new full-speed USB device number 104 using xhci_hcd
```
i see that it allocates the port /dev/ttyACM0 for OpenThread CoProcessor NRF but immediately it is disconnected and activates /dev/ttyACM1 for Arduino Nano 33 BLE which might not be the right port to which spinel can connect.
in ot-deamon, if i try to connect to this port, ot-daemon init fails since it is unable to find the socket to which it connects to the board. So, effectively port is not available for spinel to communicate with the board.
```
$ sudo ./build/posix/src/posix/ot-daemon -v 'spinel+hdlc+uart:///dev/ttyACM1?uart-baudrate=115200'
[sudo] password for ohos-bld:
./build/posix/src/posix/ot-daemon[297929]: Running OPENTHREAD/thread-reference-20200818-1035-g3a7e836dd-dirty; POSIX; Jun 30 2021 18:40:07
./build/posix/src/posix/ot-daemon[297929]: Thread version: 3
./build/posix/src/posix/ot-daemon[297929]: [CRIT]-PLAT----: Init() at ../../src/lib/spinel/radio_spinel_impl.hpp:274: Failure
```
I am stuck here, any help or pointers will be very useful.
Thanks,
Nagesh.
Issue Description: I am trying to flash and run openthread rcp sample as explained in the link: https://docs.zephyrproject.org/latest/samples/net/openthread/coprocessor/README.html. I am able to flash the image successfully, but port for spinel to connect to board seems to be off and thus ot-daemon is failing since it cannot find the socket on which it exchanges the HDLC frames and thus ot-daemon init is failing.
With further analysis, i found that, the /dev/ttyACM0 is allocated for openthread coprocessor but that seems to get disconnected and then again /dev/ttyACM1 is created which apparently doesn't looks like belonging to RCP.
my config as below:
i am using boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig from upstream master without any changes.
but changing config under samples/net/openthread/coprocessor as below:
prj.conf: commented CONFIG_UART_CONSOLE_ON_DEV_NAME to avoid shell/console which might conflict with spinel.
added a new file overlay-usb-arduino-coprocessor.conf with values as below: (Without this overlay file, once flashed, /dev/ttyACMx was not showing up in dmesg and thus board was not accessible for spinel)
```
# Arduino NCP/RCP USB CDC-ACM
# Use USB-CDC-ACM for Co-Processor
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="OpenThread CoProcessor NRF"
CONFIG_USB_CDC_ACM=y
CONFIG_UART_LINE_CTRL=y
CONFIG_USB_REQUEST_BUFFER_SIZE=2048
CONFIG_ISR_STACK_SIZE=4096
## added for testing
CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
```
command to build and flash:
west build -p auto -b arduino_nano_33_ble samples/net/openthread/coprocessor -- -DCONF_FILE="prj.conf overlay-rcp.conf overlay-usb-arduino-rcp.conf"
west flash --bossac="path to arudino bossac"
once flashing is done, dmesg shows as below:
```
$ sudo dmesg
[92443.138797] usb 1-2: USB disconnect, device number 100
[92445.514950] usb 1-2: new full-speed USB device number 101 using xhci_hcd
[92445.668022] usb 1-2: New USB device found, idVendor=2341, idProduct=005a, bcdDevice= 0.11
[92445.668036] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92445.668042] usb 1-2: Product: Arduino Nano 33 BLE
[92445.668047] usb 1-2: Manufacturer: Arduino
[92445.668051] usb 1-2: SerialNumber: 0000000000000000768275C7726D618B
[92445.671199] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[92445.750532] usb 1-2: USB disconnect, device number 101
[92446.058962] usb 1-2: new full-speed USB device number 102 using xhci_hcd
[92446.210705] usb 1-2: New USB device found, idVendor=2fe3, idProduct=0100, bcdDevice= 2.06
[92446.210718] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92446.210724] usb 1-2: Product: OpenThread CoProcessor NRF
[92446.210729] usb 1-2: Manufacturer: ZEPHYR
[92446.210733] usb 1-2: SerialNumber: 53235D59E996F2DD
[92446.213710] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[92446.965464] usb 1-2: USB disconnect, device number 102
[92447.286888] usb 1-2: new full-speed USB device number 103 using xhci_hcd
[92447.437855] usb 1-2: New USB device found, idVendor=2341, idProduct=005a, bcdDevice= 0.11
[92447.437858] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[92447.437859] usb 1-2: Product: Arduino Nano 33 BLE
[92447.437860] usb 1-2: Manufacturer: Arduino
[92447.437861] usb 1-2: SerialNumber: 0000000000000000768275C7726D618B
[92447.440050] cdc_acm 1-2:1.0: ttyACM1: USB ACM device
[92447.476098] usb 1-2: USB disconnect, device number 103
[92447.786887] usb 1-2: new full-speed USB device number 104 using xhci_hcd
```
i see that it allocates the port /dev/ttyACM0 for OpenThread CoProcessor NRF but immediately it is disconnected and activates /dev/ttyACM1 for Arduino Nano 33 BLE which might not be the right port to which spinel can connect.
in ot-deamon, if i try to connect to this port, ot-daemon init fails since it is unable to find the socket to which it connects to the board. So, effectively port is not available for spinel to communicate with the board.
```
$ sudo ./build/posix/src/posix/ot-daemon -v 'spinel+hdlc+uart:///dev/ttyACM1?uart-baudrate=115200'
[sudo] password for ohos-bld:
./build/posix/src/posix/ot-daemon[297929]: Running OPENTHREAD/thread-reference-20200818-1035-g3a7e836dd-dirty; POSIX; Jun 30 2021 18:40:07
./build/posix/src/posix/ot-daemon[297929]: Thread version: 3
./build/posix/src/posix/ot-daemon[297929]: [CRIT]-PLAT----: Init() at ../../src/lib/spinel/radio_spinel_impl.hpp:274: Failure
```
I am stuck here, any help or pointers will be very useful.
Thanks,
Nagesh.