Skip to content

Commit

Permalink
samples: update direct_test_mode sample to match HWMv2
Browse files Browse the repository at this point in the history
Update Direct Test Mode sample to support HWMv2

This update includes removing custom board handlig, as this is no longer
feasible considered the possibilities of using shortened board
qualifiers as well as legacy board names.

Instead the config fragments and overlay files has been reorganized to
take advantage of FILE_SUFFIX feature.

A custom handling for shield overlay had to be made, because Zephyr
does not support application specific board with shield overlay files.
However, this custom handling has been made so that it does not require
custom handling of HWMv2 board names.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
  • Loading branch information
tejlmand authored and gmarull committed Apr 30, 2024
1 parent fd88d8d commit 8da8102
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 90 deletions.
33 changes: 8 additions & 25 deletions samples/bluetooth/direct_test_mode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
12 changes: 3 additions & 9 deletions samples/bluetooth/direct_test_mode/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=============================
Expand All @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
<&gpio0 7 0>;
};
};

#if NRF21540EK
#include "nrf21540ek.overlay"
#endif

This file was deleted.

19 changes: 0 additions & 19 deletions samples/bluetooth/direct_test_mode/conf/remote_shell_nrf53.overlay

This file was deleted.

15 changes: 0 additions & 15 deletions samples/bluetooth/direct_test_mode/overlay-hci-nrf53.conf

This file was deleted.

9 changes: 0 additions & 9 deletions samples/bluetooth/direct_test_mode/overlay-hci.conf

This file was deleted.

31 changes: 31 additions & 0 deletions samples/bluetooth/direct_test_mode/prj_hci.conf
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions samples/bluetooth/direct_test_mode/prj_usb.conf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions samples/bluetooth/direct_test_mode/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8da8102

Please sign in to comment.