diff --git a/samples/bluetooth/direct_test_mode/CMakeLists.txt b/samples/bluetooth/direct_test_mode/CMakeLists.txt index d3cdf039086e..8d42fd418af6 100644 --- a/samples/bluetooth/direct_test_mode/CMakeLists.txt +++ b/samples/bluetooth/direct_test_mode/CMakeLists.txt @@ -5,33 +5,16 @@ # cmake_minimum_required(VERSION 3.20.0) -if(DEFINED SHIELD AND "${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") - string(REPLACE " " ";" SHIELD_LIST "${SHIELD}") - foreach(sh IN LISTS SHIELD_LIST) - if("${sh}" STREQUAL "nrf21540ek") - if(CONFIG_DTM_USB) - set(remote_shell_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell/nrf21540ek_usb.overlay) - else() - set(remote_shell_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell/nrf21540ek.overlay) - endif() - - break() - endif() - endforeach() +# Zephyr doesn't support application specific shield overlays. +# Therefore pass shiled information to the board overlay as a define so that +# so that the shield overlay is included if required by the board overlay. +string(REPLACE " " ";" shield_list "${SHIELD}") +if("nrf21540ek" IN_LIST shield_list) + set(remote_shell_DTS_EXTRA_CPPFLAGS "-DNRF21540EK") endif() -if(NOT DEFINED remote_shell_DTC_OVERLAY_FILE AND CONFIG_DTM_USB) - set(remote_shell_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell/usb.overlay) -endif() - -if(CONFIG_DTM_USB) - set(remote_shell_CONF_FILE ${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell/prj_usb.conf) -endif() - -if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") - if(NOT "${EXTRA_CONF_FILE}" STREQUAL "overlay-hci-nrf53.conf") - set(EXTRA_DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell_nrf53.overlay") - endif() +if(DEFINED FILE_SUFFIX AND NOT DEFINED remote_shell_FILE_SUFFIX) + set(remote_shell_FILE_SUFFIX ${FILE_SUFFIX}) endif() find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) diff --git a/samples/bluetooth/direct_test_mode/README.rst b/samples/bluetooth/direct_test_mode/README.rst index dbafa5631e8f..05686fd231c2 100644 --- a/samples/bluetooth/direct_test_mode/README.rst +++ b/samples/bluetooth/direct_test_mode/README.rst @@ -385,13 +385,7 @@ To build the sample with an HCI interface, use the following command: .. code-block:: console - west build samples/bluetooth/direct_test_mode -b board_name -- -DEXTRA_CONF_FILE=overlay-hci.conf - -On the |nRF5340DKnoref| the sample with HCI interface can also be built with the `remote_hci` image using the following command: - -.. code-block:: console - - west build samples/bluetooth/direct_test_mode -b board_name -- -DEXTRA_CONF_FILE=overlay-hci-nrf53.conf + west build samples/bluetooth/direct_test_mode -b board_name -- -DFILE_SUFFIX=hci USB CDC ACM transport variant ============================= @@ -401,14 +395,14 @@ Use the following command: .. code-block:: console - west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DCONFIG_DTM_USB=y + west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DFILE_SUFFIX=usb You can also build this sample with support for the front-end module. Use the following command: .. code-block:: console - west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DSHIELD=nrf21540ek -DCONFIG_DTM_USB=y + west build samples/bluetooth/direct_test_mode -b nrf5340dk/nrf5340/cpunet -- -DSHIELD=nrf21540ek -DFILE_SUFFIX=usb .. _dtm_testing: diff --git a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.overlay b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.overlay index 373e538c5fd7..1efb596c95d1 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.overlay +++ b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.overlay @@ -4,6 +4,20 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +/ { + chosen { + ncs,dtm-uart = &uart0; + }; +}; + +&uart0 { + status = "okay"; + compatible = "nordic,nrf-ipc-uart"; + ipc = <&ipc0>; + ept-name = "remote shell"; + current-speed = <19200>; +}; + &radio { status = "okay"; /* This is a number of antennas that are available on antenna matrix diff --git a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf new file mode 100644 index 000000000000..9b795d16a291 --- /dev/null +++ b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf @@ -0,0 +1,23 @@ +# +# Copyright (c) 2021 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_IPC_SERVICE=y +CONFIG_IPC_SERVICE_BACKEND_RPMSG=y +CONFIG_MBOX=y + +CONFIG_NRFX_DPPI=y + +CONFIG_HEAP_MEM_POOL_SIZE=4096 + +# Do not build Remote shell APP Core sample for the application core in hci mode +CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE=n + +CONFIG_NCS_SAMPLE_DTM_REMOTE_HCI_CHILD_IMAGE=y +CONFIG_NRF_RPC=y +CONFIG_NRF_RPC_CBOR=y + +CONFIG_DTM_TRANSPORT_HCI=y +CONFIG_NET_BUF=y diff --git a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.overlay b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.overlay new file mode 100644 index 000000000000..373e538c5fd7 --- /dev/null +++ b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.overlay @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&radio { + status = "okay"; + /* This is a number of antennas that are available on antenna matrix + * designed by Nordic. For more information see README.rst. + */ + dfe-antenna-num = <12>; + /* This is a setting that enables antenna 12 (in antenna matrix designed + * by Nordic) for PDU. For more information see README.rst. + */ + dfe-pdu-antenna = <0x0>; + + /* These are GPIO pin numbers that are provided to + * Radio peripheral. The pins will be acquired by Radio to + * drive antenna switching. + * Pin numbers are selected to drive switches on antenna matrix + * desinged by Nordic. For more information see README.rst. + */ + dfegpio0-gpios = <&gpio0 4 0>; + dfegpio1-gpios = <&gpio0 5 0>; + dfegpio2-gpios = <&gpio0 6 0>; + dfegpio3-gpios = <&gpio0 7 0>; +}; diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/nrf21540ek.overlay b/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf21540ek.overlay similarity index 100% rename from samples/bluetooth/direct_test_mode/conf/remote_shell/nrf21540ek.overlay rename to samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf21540ek.overlay diff --git a/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf5340dk_nrf5340_cpuapp.overlay index 3bdcc7c0c416..9dac3c975011 100644 --- a/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -24,3 +24,7 @@ <&gpio0 7 0>; }; }; + +#if NRF21540EK +#include "nrf21540ek.overlay" +#endif diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/pin_fwd.dts b/samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/pin_fwd.dts similarity index 100% rename from samples/bluetooth/direct_test_mode/conf/remote_shell/pin_fwd.dts rename to samples/bluetooth/direct_test_mode/child_image/remote_shell/boards/pin_fwd.dts diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/prj_usb.conf b/samples/bluetooth/direct_test_mode/child_image/remote_shell/prj_usb.conf similarity index 100% rename from samples/bluetooth/direct_test_mode/conf/remote_shell/prj_usb.conf rename to samples/bluetooth/direct_test_mode/child_image/remote_shell/prj_usb.conf diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/usb.overlay b/samples/bluetooth/direct_test_mode/child_image/remote_shell_usb.overlay similarity index 100% rename from samples/bluetooth/direct_test_mode/conf/remote_shell/usb.overlay rename to samples/bluetooth/direct_test_mode/child_image/remote_shell_usb.overlay diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/usb.dts b/samples/bluetooth/direct_test_mode/child_image/usb.dts similarity index 100% rename from samples/bluetooth/direct_test_mode/conf/remote_shell/usb.dts rename to samples/bluetooth/direct_test_mode/child_image/usb.dts diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell/nrf21540ek_usb.overlay b/samples/bluetooth/direct_test_mode/conf/remote_shell/nrf21540ek_usb.overlay deleted file mode 100644 index 9d5409cf4c46..000000000000 --- a/samples/bluetooth/direct_test_mode/conf/remote_shell/nrf21540ek_usb.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include "usb.dts" -#include "pin_fwd.dts" diff --git a/samples/bluetooth/direct_test_mode/conf/remote_shell_nrf53.overlay b/samples/bluetooth/direct_test_mode/conf/remote_shell_nrf53.overlay deleted file mode 100644 index 05eb2d5d9fe4..000000000000 --- a/samples/bluetooth/direct_test_mode/conf/remote_shell_nrf53.overlay +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - chosen { - ncs,dtm-uart = &uart0; - }; -}; - -&uart0 { - status = "okay"; - compatible = "nordic,nrf-ipc-uart"; - ipc = <&ipc0>; - ept-name = "remote shell"; - current-speed = <19200>; -}; diff --git a/samples/bluetooth/direct_test_mode/overlay-hci-nrf53.conf b/samples/bluetooth/direct_test_mode/overlay-hci-nrf53.conf deleted file mode 100644 index 3dda4d3c8e83..000000000000 --- a/samples/bluetooth/direct_test_mode/overlay-hci-nrf53.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE=n -CONFIG_IPC_UART=n - -CONFIG_NCS_SAMPLE_DTM_REMOTE_HCI_CHILD_IMAGE=y -CONFIG_NRF_RPC=y -CONFIG_NRF_RPC_CBOR=y - -CONFIG_DTM_TRANSPORT_HCI=y -CONFIG_NET_BUF=y diff --git a/samples/bluetooth/direct_test_mode/overlay-hci.conf b/samples/bluetooth/direct_test_mode/overlay-hci.conf deleted file mode 100644 index 3c07dad787fb..000000000000 --- a/samples/bluetooth/direct_test_mode/overlay-hci.conf +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_DTM_TRANSPORT_HCI=y -CONFIG_NET_BUF=y -CONFIG_UART_ASYNC_API=y diff --git a/samples/bluetooth/direct_test_mode/prj_hci.conf b/samples/bluetooth/direct_test_mode/prj_hci.conf new file mode 100644 index 000000000000..3b00c98335d9 --- /dev/null +++ b/samples/bluetooth/direct_test_mode/prj_hci.conf @@ -0,0 +1,31 @@ +# +# Copyright (c) 2020 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Configure assertions +CONFIG_ASSERT=y +CONFIG_ASSERT_NO_COND_INFO=y +CONFIG_ASSERT_NO_MSG_INFO=y + +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n + +CONFIG_LOG=y +CONFIG_LOG_PRINTK=y +CONFIG_USE_SEGGER_RTT=y +CONFIG_LOG_BACKEND_RTT=y + +# Use necessary peripherals +CONFIG_NRFX_TIMER0=y +CONFIG_NRFX_TIMER1=y +CONFIG_NRFX_TIMER2=y + +CONFIG_FEM_AL_LIB=y + +CONFIG_DTM_TRANSPORT_HCI=y +CONFIG_NET_BUF=y +CONFIG_UART_ASYNC_API=y diff --git a/samples/bluetooth/direct_test_mode/prj_usb.conf b/samples/bluetooth/direct_test_mode/prj_usb.conf new file mode 100644 index 000000000000..12d257fa3296 --- /dev/null +++ b/samples/bluetooth/direct_test_mode/prj_usb.conf @@ -0,0 +1,29 @@ +# +# Copyright (c) 2020 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Configure assertions +CONFIG_ASSERT=y +CONFIG_ASSERT_NO_COND_INFO=y +CONFIG_ASSERT_NO_MSG_INFO=y + +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n + +CONFIG_LOG=y +CONFIG_LOG_PRINTK=y +CONFIG_USE_SEGGER_RTT=y +CONFIG_LOG_BACKEND_RTT=y + +# Use necessary peripherals +CONFIG_NRFX_TIMER0=y +CONFIG_NRFX_TIMER1=y +CONFIG_NRFX_TIMER2=y + +CONFIG_FEM_AL_LIB=y + +CONFIG_DTM_USB=y diff --git a/samples/bluetooth/direct_test_mode/sample.yaml b/samples/bluetooth/direct_test_mode/sample.yaml index 3cc160662b9f..655e9fb1a8ac 100644 --- a/samples/bluetooth/direct_test_mode/sample.yaml +++ b/samples/bluetooth/direct_test_mode/sample.yaml @@ -24,17 +24,14 @@ tests: tags: bluetooth ci_build sample.bluetooth.direct_test_mode.nrf5340_usb: build_only: true - extra_configs: - - CONFIG_DTM_USB=y + extra_args: FILE_SUFFIX=usb integration_platforms: - nrf5340dk/nrf5340/cpunet platform_allow: nrf5340dk/nrf5340/cpunet tags: bluetooth ci_build sample.bluetooth.direct_test_mode.nrf5340_nrf21540_usb: build_only: true - extra_args: SHIELD=nrf21540ek - extra_configs: - - CONFIG_DTM_USB=y + extra_args: SHIELD=nrf21540ek FILE_SUFFIX=usb integration_platforms: - nrf5340dk/nrf5340/cpunet platform_allow: nrf5340dk/nrf5340/cpunet