Skip to content

Commit 1747bd7

Browse files
jfischer-noaescolar
authored andcommitted
samples: openthread: uset new USB device stack in coprocessor sample
Use CDC ACM serial backend from the new USB device stack. It was surprising to find out that the porting layer does not only use the UART API. The legacy USB device stack API used in the porting layer has been deprecated and is causing CI failures. Signed-off-by: Johann Fischer <[email protected]>
1 parent a5c0ba8 commit 1747bd7

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

modules/openthread/platform/uart.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,6 @@ otError otPlatUartEnable(void)
169169
(void *)&ot_uart);
170170

171171
if (DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_ot_uart), zephyr_cdc_acm_uart)) {
172-
int ret;
173-
174-
ret = usb_enable(NULL);
175-
if (ret != 0 && ret != -EALREADY) {
176-
LOG_ERR("Failed to enable USB");
177-
return OT_ERROR_FAILED;
178-
}
179-
180172
/* Data Carrier Detect Modem - mark connection as established */
181173
(void)uart_line_ctrl_set(ot_uart.dev, UART_LINE_CTRL_DCD, 1);
182174
/* Data Set Ready - the NCP SoC is ready to communicate */
@@ -190,14 +182,6 @@ otError otPlatUartEnable(void)
190182

191183
otError otPlatUartDisable(void)
192184
{
193-
if (DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_ot_uart), zephyr_cdc_acm_uart)) {
194-
int ret = usb_disable();
195-
196-
if (ret) {
197-
LOG_WRN("Failed to disable USB (%d)", ret);
198-
}
199-
}
200-
201185
uart_irq_tx_disable(ot_uart.dev);
202186
uart_irq_rx_disable(ot_uart.dev);
203187
return OT_ERROR_NONE;

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
33

44
CONFIG_STDOUT_CONSOLE=y
55
CONFIG_GPIO=y
6-
CONFIG_USB_DEVICE_STACK=y
7-
CONFIG_USB_DEVICE_PRODUCT="OpenThread Co-Processor K64"
86
CONFIG_LOG=y
9-
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
10-
CONFIG_USB_CDC_ACM=y
11-
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
12-
CONFIG_SERIAL=y
13-
CONFIG_UART_INTERRUPT_DRIVEN=y
7+
8+
CONFIG_USB_DEVICE_STACK_NEXT=y
9+
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
10+
CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="OpenThread Co-Processor K64"
11+
CONFIG_USBD_CDC_ACM_LOG_LEVEL_OFF=y
1412
CONFIG_UART_LINE_CTRL=y
15-
CONFIG_USB_REQUEST_BUFFER_SIZE=2048
1613

1714
# disable ethernet on K64
1815
CONFIG_NET_L2_ETHERNET=n

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
44

55
# Use USB-CDC-ACM for Co-Processor
6-
CONFIG_USB_DEVICE_STACK=y
7-
CONFIG_USB_DEVICE_PRODUCT="OpenThread CoProcessor NRF"
8-
CONFIG_USB_CDC_ACM=y
6+
CONFIG_USB_DEVICE_STACK_NEXT=y
7+
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
8+
CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="OpenThread CoProcessor NRF"
9+
CONFIG_USBD_CDC_ACM_LOG_LEVEL_OFF=y
910
CONFIG_UART_LINE_CTRL=y
10-
CONFIG_USB_REQUEST_BUFFER_SIZE=2048
1111

1212
CONFIG_ISR_STACK_SIZE=4096

0 commit comments

Comments
 (0)