Skip to content

Commit f6fed40

Browse files
Tryton77nordicjm
authored andcommitted
samples: DTM: nRF54H20 transport over USB CDC ACM
Added support for USB CDC ACM trasnport layer for nRF54H20. JIRA: NCSDK-34868 Signed-off-by: Michał Strządała <[email protected]>
1 parent b8a88cb commit f6fed40

File tree

9 files changed

+104
-9
lines changed

9 files changed

+104
-9
lines changed

samples/bluetooth/direct_test_mode/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ config ANOMALY_172_TIMER_IRQ_PRIORITY
3535
Levels are from 0 (highest priority) to 6 (lowest priority)
3636

3737
config DTM_USB
38-
bool "DTM over USB CDC ACM class"
39-
depends on SOC_NRF5340_CPUNET && !DTM_TRANSPORT_HCI
38+
bool "DTM over USB CDC ACM class [EXPERIMENTAL]"
39+
depends on (SOC_NRF5340_CPUNET || SOC_NRF54H20_CPURAD) && !DTM_TRANSPORT_HCI
4040
select EXPERIMENTAL
4141
help
4242
Use USB instead of UART as the DTM interface. For nRF5340 the USB from application core

samples/bluetooth/direct_test_mode/README.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,26 @@ On the |nRF5340DKnoref|, you can build the sample with HCI interface with the ``
401401
USB CDC ACM transport variant
402402
=============================
403403

404-
On the nRF5340 development kit, you can build this sample configured to use the USB interface as a communication interface with the tester.
405-
Use the following command:
404+
On the nRF5340 and nRF54H20 development kits, you can build this sample configured to use the USB interface as a communication interface with the tester.
405+
406+
Use the following command for nRF54H20:
407+
408+
.. code-block:: console
409+
410+
west build samples/bluetooth/direct_test_mode -b nrf54h20dk/nrf54h20/cpurad -- -DFILE_SUFFIX=usb_54h20
411+
412+
Use the following command for nRF5340:
406413

407414
.. code-block:: console
408415
409-
west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DFILE_SUFFIX=usb
416+
west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DFILE_SUFFIX=usb_5340
410417
411418
You can also build this sample with support for the front-end module.
412419
Use the following command:
413420

414421
.. code-block:: console
415422
416-
west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DSHIELD=nrf21540ek -DFILE_SUFFIX=usb
423+
west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DSHIELD=nrf21540ek -DFILE_SUFFIX=usb_5340
417424
418425
.. _dtm_testing:
419426

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include "nrf54h20dk_nrf54h20_cpurad.overlay"
8+
9+
/ {
10+
chosen {
11+
ncs,dtm-uart = &cdc_acm_uart0;
12+
};
13+
};
14+
15+
&uart135 {
16+
status = "disabled";
17+
};
18+
19+
&uart136 {
20+
status = "disabled";
21+
};
22+
23+
&zephyr_udc0 {
24+
status = "okay";
25+
26+
cdc_acm_uart0: cdc_acm_uart0 {
27+
status = "okay";
28+
compatible = "zephyr,cdc-acm-uart";
29+
current-speed = <19200>;
30+
};
31+
};
File renamed without changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_ASSERT=y
7+
CONFIG_ASSERT_NO_COND_INFO=y
8+
CONFIG_ASSERT_NO_MSG_INFO=y
9+
10+
CONFIG_HW_STACK_PROTECTION=y
11+
12+
CONFIG_CONSOLE=n
13+
CONFIG_UART_CONSOLE=n
14+
15+
CONFIG_LOG=y
16+
CONFIG_LOG_PRINTK=y
17+
CONFIG_USE_SEGGER_RTT=y
18+
CONFIG_LOG_BACKEND_RTT=y
19+
CONFIG_MAIN_STACK_SIZE=2048
20+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
21+
22+
# Enable USB CDC ACM Class
23+
CONFIG_USB_DEVICE_STACK_NEXT=y
24+
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
25+
CONFIG_CDC_ACM_SERIAL_PID=0x5448
26+
CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Nordic DTM USB"
27+
CONFIG_UART_LINE_CTRL=y
28+
CONFIG_DTM_USB=y
29+
CONFIG_SERIAL=y
30+
31+
# Disable the unsupported driver
32+
CONFIG_NRFX_TIMER0=n
33+
CONFIG_NRFX_TIMER2=n
34+
35+
# Use necessary peripherals
36+
CONFIG_NRFX_TIMER020=y
37+
CONFIG_NRFX_GPPI=y
38+
CONFIG_CLOCK_CONTROL=y

samples/bluetooth/direct_test_mode/sample.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tests:
6363
sample.bluetooth.direct_test_mode.nrf5340_usb:
6464
sysbuild: true
6565
build_only: true
66-
extra_args: FILE_SUFFIX=usb
66+
extra_args: FILE_SUFFIX=usb_5340
6767
integration_platforms:
6868
- nrf5340dk/nrf5340/cpunet
6969
platform_allow: nrf5340dk/nrf5340/cpunet
@@ -76,7 +76,7 @@ tests:
7676
build_only: true
7777
extra_args:
7878
- SHIELD=nrf21540ek
79-
- FILE_SUFFIX=usb
79+
- FILE_SUFFIX=usb_5340
8080
integration_platforms:
8181
- nrf5340dk/nrf5340/cpunet
8282
platform_allow: nrf5340dk/nrf5340/cpunet
@@ -127,11 +127,22 @@ tests:
127127
build_only: true
128128
extra_args:
129129
- SHIELD=nrf2220ek
130-
- FILE_SUFFIX=usb
130+
- FILE_SUFFIX=usb_5340
131131
integration_platforms:
132132
- nrf5340dk/nrf5340/cpunet
133133
platform_allow: nrf5340dk/nrf5340/cpunet
134134
tags:
135135
- bluetooth
136136
- ci_build
137137
- sysbuild
138+
sample.bluetooth.direct_test_mode.nrf54h20_usb:
139+
sysbuild: true
140+
build_only: true
141+
extra_args: FILE_SUFFIX=usb_54h20
142+
integration_platforms:
143+
- nrf54h20dk/nrf54h20/cpurad
144+
platform_allow: nrf54h20dk/nrf54h20/cpurad
145+
tags:
146+
- bluetooth
147+
- ci_build
148+
- sysbuild

samples/bluetooth/direct_test_mode/src/transport/dtm_uart_twowire.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,14 @@ int dtm_tr_init(void)
759759
return -EIO;
760760
}
761761

762+
#if defined(CONFIG_DTM_USB) && defined(CONFIG_SOC_NRF54H20_CPURAD)
763+
/* Enable RX path for the USB CDC ACM.
764+
* uart_irq_rx_enable() -> cdc_acm_irq_rx_enable() -> cdc_acm_work_submit(rx_fifo_work)
765+
* It is not needed for non CDC ACM UARTs.
766+
*/
767+
uart_irq_rx_enable(dtm_uart);
768+
#endif /* defined(CONFIG_DTM_USB) && defined(CONFIG_SOC_NRF54H20_CPURAD) */
769+
762770
err = dtm_init(NULL);
763771
if (err) {
764772
LOG_ERR("Error during DTM initialization: %d", err);
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)