diff --git a/nordic/trezor/radio_test/CMakeLists.txt b/nordic/trezor/radio_test/CMakeLists.txt new file mode 100644 index 0000000000..37668cc282 --- /dev/null +++ b/nordic/trezor/radio_test/CMakeLists.txt @@ -0,0 +1,19 @@ +# +# Copyright (c) 2020 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(NONE) + +# Application sources +FILE(GLOB app_sources src/*.c) + +# NORDIC SDK APP START +target_sources(app PRIVATE + ${app_sources} +) +# NORDIC SDK APP END diff --git a/nordic/trezor/radio_test/Kconfig b/nordic/trezor/radio_test/Kconfig new file mode 100644 index 0000000000..d4edc610f6 --- /dev/null +++ b/nordic/trezor/radio_test/Kconfig @@ -0,0 +1,35 @@ +# +# Copyright (c) 2020 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +mainmenu "Nordic Radio test sample" + +config RADIO_TEST_USB + bool "Radio Test shell over USB CDC ACM class" + depends on SOC_NRF5340_CPUNET + select EXPERIMENTAL + help + Use USB instead of UART as the Radio Test shell transport. + For nRF5340 the USB from application core is used as communication interface. + +config RADIO_TEST_POWER_CONTROL_AUTOMATIC + bool "Automatic power control" + depends on FEM + default y + help + Set SoC output power and front-end module gain to achieve Tx output power requested + by user. If the exact value cannot be achieved, power is set to closest value which does + not exceed the limits. If this option is disabled, user has to set SoC output power and + fem gain with separate commands. + +config RADIO_TEST_RX_TIMEOUT + int "RX packet reception timeout" + default 10 + help + Specifies the time in seconds that the application waits for the first packet to be + received in RX mode when a specified number of packets are set to be received. + If the timeout is reached before the first packet is received, the radio will be disabled. + +source "Kconfig.zephyr" diff --git a/nordic/trezor/radio_test/README.rst b/nordic/trezor/radio_test/README.rst new file mode 100644 index 0000000000..2f4a440a80 --- /dev/null +++ b/nordic/trezor/radio_test/README.rst @@ -0,0 +1,305 @@ +.. _radio_test: + +Radio test (short-range) +######################## + +.. contents:: + :local: + :depth: 2 + +The Radio test sample demonstrates how to configure the 2.4 GHz short-range radio (Bluetooth® LE, IEEE 802.15.4 and proprietary) in a specific mode and then test its performance. +The sample provides a set of predefined commands that allow you to configure the radio in three modes: + +* Constant RX or TX carrier +* Modulated TX carrier +* RX or TX sweep + +Requirements +************ + +The sample supports the following development kits: + +.. table-from-sample-yaml:: + +You can use any one of the development kits listed above. + +.. note:: + On nRF5340 DK and nRF7002 DK, the sample is designed to run on the network core and requires the :ref:`nrf5340_remote_shell` running on the application core. + This sample uses the :ref:`shell_ipc_readme` library to forward shell data through the physical UART interface of the application core. + +The sample also requires one of the following testing devices: + + * Another development kit with the same sample. + See :ref:`radio_test_testing_board`. + * Another development kit connected to a PC with the `RSSI Viewer app`_ (available in the `nRF Connect for Desktop`_). + See :ref:`radio_test_testing_rssi`. + +.. note:: + You can perform the radio test also using a spectrum analyzer. + This method of testing is not covered by this documentation. + +nRF21540 front-end module +========================= + +.. include:: /includes/sample_dtm_radio_test_fem.txt + +You can configure the nRF21540 front-end module (FEM) transmitted power control, antenna output and activation delay using the main shell commands of the :ref:`radio_test_ui`. + +Skyworks front-end module +========================= + +.. include:: /includes/sample_dtm_radio_test_skyworks.txt + +You can configure the Skyworks front-end module (FEM) antenna output and activation delay using the main shell commands of the :ref:`radio_test_ui`. + +Overview +******** + +To run the tests, connect to the development kit through the serial port and send shell commands. +Zephyr's :ref:`zephyr:shell_api` module is used to handle the commands. +At any time during the tests, you can dynamically set the radio parameters, such as output power, bit rate, and channel. +In sweep mode, you can set the time for which the radio scans each channel from one millisecond to 99 milliseconds, in steps of one millisecond. +The sample also allows you to send a data pattern to another development kit. + +The sample first enables the high frequency crystal oscillator and configures the shell. +You can then start running commands to set up and control the radio. +See :ref:`radio_test_ui` for a list of available commands. + +.. note:: + For the IEEE 802.15.4 mode, the start channel and the end channel must be within the channel range of 11 to 26. + Use the ``start_channel`` and ``end_channel`` commands to control this setting. + + +.. _radio_test_ui: + +User interface +************** +.. list-table:: Main shell commands (in alphabetical order) + :header-rows: 1 + + * - Command + - Argument + - Description + * - cancel + - + - Cancel the sweep or the carrier. + * - data_rate + - + - Set the data rate. + * - end_channel + - + - End channel for the sweep (in MHz, as difference from 2400 MHz). + * - fem + - + - Set front-end module (FEM) parameters. + * - output_power + - + - Output power set. + If a front-end module is attached and the :ref:`CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC ` Kconfig option is enabled, it has the same effect as the ``total_output_power`` command. + * - parameters_print + - + - Print current delay, channel, and other parameters. + * - print_rx + - + - Print the received RX payload. + * - start_channel + - + - Start channel for the sweep or the channel for the constant carrier (in MHz, as difference from 2400 MHz). + * - start_duty_cycle_modulated_tx + - + - Duty cycle in percent (two decimal digits, between 01 and 90). + * - start_rx + - + - Start RX (continuous RX mode is used if no argument is provided). + * - start_rx_sweep + - + - Start the RX sweep. + * - start_tx_carrier + - + - Start the TX carrier. + * - start_tx_modulated_carrier + - + - Start the modulated TX carrier (continuous TX mode is used if no argument is provided). + * - start_tx_sweep + - + - Start the TX sweep. + * - time_on_channel + -