Skip to content

Commit f460848

Browse files
jfischer-nocfriedt
authored andcommitted
net: ot: rework NCP interface configuration
Rework NCP interface configuration and NCP sample. Remove CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME and CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM Kconfig options in favor of chosen node zephyr,ot-uart usage. Signed-off-by: Johann Fischer <[email protected]>
1 parent e1d5416 commit f460848

File tree

12 files changed

+56
-45
lines changed

12 files changed

+56
-45
lines changed

doc/reference/devicetree/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ device.
339339
interprocess-communication (IPC)
340340
* - zephyr,itcm
341341
- Instruction Tightly Coupled Memory node on some Arm SoCs
342+
* - zephyr,ot-uart
343+
- Used by the OpenThread to specify UART device for Spinel protocol
342344
* - zephyr,shell-uart
343345
- Sets default :kconfig:`CONFIG_UART_SHELL_ON_DEV_NAME`
344346
* - zephyr,sram

doc/releases/release-notes-2.7.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ Removed APIs in this release
4747
* Removed support for the Kconfig ``USB`` option. Option ``USB_DEVICE_STACK``
4848
is sufficient to enable USB device support.
4949

50+
* Removed ``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM`` and
51+
``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME`` Kconfig options
52+
in favor of chosen node ``zephyr,ot-uart``.
53+
5054
============================
5155

5256
Stable API changes in this release

samples/net/openthread/coprocessor/README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Build the OpenThread NCP sample application like this:
3232
:goals: build
3333
:compact:
3434

35+
Build the OpenThread NCP sample application which uses CDC ACM UART device:
36+
37+
.. zephyr-app-commands::
38+
:zephyr-app: samples/net/openthread/coprocessor
39+
:board: nrf52840dk_nrf52840
40+
:goals: build flash
41+
:gen-args: -DDTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb-nrf-br.conf
42+
:compact:
43+
3544
Example building for the nrf52840dk_nrf52840 for RCP:
3645

3746
.. zephyr-app-commands::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ot-uart = &uart0;
10+
zephyr,console = &uart1;
11+
};
12+
};

samples/net/openthread/coprocessor/overlay-tri-n4m-br.conf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
# TRI n4m BR
2-
# Use UART_0 for Shell/Console
3-
CONFIG_UART_SHELL_ON_DEV_NAME="UART_0"
4-
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
52
CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
63

7-
# Use UART_1 for Co-Processor
8-
#CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="UART_1"
9-
10-
# Use USB-CDC-ACM for NCP
11-
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
12-
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
13-
144
CONFIG_STDOUT_CONSOLE=y
155
CONFIG_GPIO=y
166
CONFIG_USB_DEVICE_STACK=y

samples/net/openthread/coprocessor/overlay-usb-nrf-br.conf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
# Nordic NCP USB CDC-ACM
22

3-
# Use UART_0 for Shell/Console
4-
CONFIG_UART_SHELL_ON_DEV_NAME="UART_0"
5-
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
63
CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
74

85
# Use USB-CDC-ACM for Co-Processor
9-
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
10-
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
116
CONFIG_USB_DEVICE_STACK=y
127
CONFIG_USB_DEVICE_PRODUCT="OpenThread CoProcessor NRF"
138
CONFIG_USB_CDC_ACM=y

samples/net/openthread/coprocessor/prj.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ CONFIG_OPENTHREAD_BORDER_AGENT=y
3333
CONFIG_OPENTHREAD_BORDER_ROUTER=y
3434
CONFIG_OPENTHREAD_UDP_FORWARD=y
3535
CONFIG_OPENTHREAD_ENABLE_SERVICE=y
36-
37-
# Move console to other UART to not interfere with NCP
38-
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1"

samples/net/openthread/coprocessor/sample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tests:
1616
platform_allow: nrf52840dk_nrf52840 nrf52833dk_nrf52833
1717
tags: ci_build
1818
extra_args: OVERLAY_CONFIG=overlay-usb-nrf-br.conf
19+
DTC_OVERLAY_FILE="usb.overlay"
1920
samples.openthread.coprocessor.rcp:
2021
build_only: true
2122
platform_allow: nrf52840dk_nrf52840 nrf52833dk_nrf52833
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ot-uart = &cdc_acm_uart0;
10+
};
11+
};
12+
13+
&zephyr_udc0 {
14+
cdc_acm_uart0: cdc_acm_uart0 {
15+
compatible = "zephyr,cdc-acm-uart";
16+
label = "CDC_ACM_0";
17+
};
18+
};

subsys/logging/Kconfig.backends

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ endif # LOG_BACKEND_RTT
187187

188188
config LOG_BACKEND_SPINEL
189189
bool "Enable OpenThread dedicated Spinel protocol backend"
190-
depends on (OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME!=UART_CONSOLE_ON_DEV_NAME || !LOG_BACKEND_UART)
190+
depends on !LOG_BACKEND_UART
191191
depends on NET_L2_OPENTHREAD
192192
help
193193
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.

0 commit comments

Comments
 (0)