1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-21 09:39:02 +00:00

radio test - NRF

This commit is contained in:
tychovrahe 2025-03-21 11:17:19 +01:00
parent f2048ad9b5
commit d10863ce70
21 changed files with 3721 additions and 0 deletions

View File

@ -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

View File

@ -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"

View File

@ -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
- <sub_cmd>
- Set the data rate.
* - end_channel
- <channel>
- End channel for the sweep (in MHz, as difference from 2400 MHz).
* - fem
- <sub_cmd>
- Set front-end module (FEM) parameters.
* - output_power
- <sub_cmd>
- Output power set.
If a front-end module is attached and the :ref:`CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC <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
- <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>
- Duty cycle in percent (two decimal digits, between 01 and 90).
* - start_rx
- <packet_num>
- 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
- <packet_num>
- 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
- <time>
- Time on each channel in ms (between 1 and 99).
* - toggle_dcdc_state
- <state>
- Toggle DC/DC converter state.
* - transmit_pattern
- <sub_cmd>
- Set transmission pattern.
* - total_output_power
- <tx output power>
- Set total output power in dBm.
This value includes SoC output power and front-end module gain.
TX output power
===============
This sample has a few commands that you can use to test the device output power.
The behavior of the commands vary depending on the hardware configuration and Kconfig options as follows:
* Radio Test without front-end module support:
* The ``output_power`` command sets the SoC output command with a subcommand set.
The output power is set directly in the radio peripheral.
* Radio Test with front-end module support in default configuration (the :ref:`CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC <CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC>` Kconfig option is enabled):
* The ``output_power`` command sets the total output power, including front-end module gain.
* The ``total_output_power`` command sets the total output power, including front-end module gain with a value in dBm unit provided by user.
* For these commands, the radio peripheral and FEM transmit power control is calculated and set automatically to meet your requirements.
* If an exact output power value cannot be set, a lower value is used.
* Radio Test with front-end module support and manual TX output power control (the :ref:`CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC <CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC>` Kconfig option is disabled):
* The ``output_power`` command sets the SoC output command with a subcommands set.
* The ``fem`` command with the ``tx_power_control`` subcommand sets the front-end module transmit power control to a value for given specific front-end module.
* You can use this configuration to perform tests on your hardware design.
Configuration
*************
|config|
Configuration options
=====================
Check and configure the following Kconfig options:
.. _CONFIG_RADIO_TEST_USB:
CONFIG_RADIO_TEST_USB
Selects USB instead of UART as the Radio Test shell transport.
For nRF5340 the USB from application core is used as the communication interface.
.. _CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC:
CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC
Sets the SoC output power and front-end module gain to achieve the requested TX output power.
If the exact value cannot be achieved, power is set to closest value that does not exceed the limits.
If this option is disabled, set the SoC output power and FEM gain with separate commands.
Building and running
********************
.. |sample path| replace:: :file:`samples/peripheral/radio_test`
.. include:: /includes/build_and_run.txt
.. include:: /includes/nRF54H20_erase_UICR.txt
.. note::
|54H_engb_2_8|
.. note::
On the nRF5340 or nRF7002 development kit, the Radio Test sample requires the :ref:`nrf5340_remote_shell` sample on the application core.
The Remote IPC shell sample is built and programmed automatically by default.
If you want to program your custom solution for the application core, unset the :kconfig:option:`CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE` Kconfig option.
Remote USB CDC ACM Shell variant
================================
This sample can run the remote IPC Service Shell through the USB on the nRF5340 DK application core.
For example, when building on the command line, use the following command:
.. code-block:: console
west build samples/peripheral/radio_test -b nrf5340dk/nrf5340/cpunet -- -DFILE_SUFFIX=usb
You can also build this sample with the remote IPC Service Shell and support for the front-end module.
You can use the following command:
.. code-block:: console
west build samples/peripheral/radio_test -b nrf5340dk/nrf5340/cpunet -- -DSHIELD=nrf21540ek -DFILE_SUFFIX=usb
.. include:: /includes/nRF54H20_erase_UICR.txt
.. note::
You can also build the sample with the remote IPC Service Shell for the |nRF7002DKnoref| using the ``nrf7002dk/nrf5340/cpunet`` board target in the commands.
.. _radio_test_testing:
Testing
=======
After programming the sample to your development kit, complete the following steps to test it in one of the following two ways:
.. note::
For the |nRF5340DKnoref| or |nRF7002DKnoref|, see :ref:`logging_cpunet` for information about the COM terminals on which the logging output is available.
.. _radio_test_testing_board:
Testing with another development kit
------------------------------------
Complete the following steps:
1. Connect both development kits to the computer using a USB cable.
The kits are assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
#. |connect_terminal_both_ANSI|
#. Run the following commands on one of the kits:
a. Set the data rate with the ``data_rate`` command to ``ble_2Mbit``.
#. Set the transmission pattern with the ``transmit_pattern`` command to ``pattern_11110000``.
#. Set the radio channel with the ``start_channel`` command to 40.
#. Repeat all steps for the second kit.
#. On both kits, run the ``parameters_print`` command to confirm that the radio configuration is the same on both kits.
#. Set one kit in the Modulated TX Carrier mode using the ``start_tx_modulated_carrier`` command.
#. Set the other kit in the RX Carrier mode using the ``start_rx`` command.
#. Print the received data with the ``print_rx`` command and confirm that they match the transmission pattern (0xF0).
.. _radio_test_testing_rssi:
Testing with the RSSI Viewer app
--------------------------------
Complete the following steps:
1. Connect the kit to the computer using a USB cable.
The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
#. |connect_terminal_ANSI|
#. Set the start channel with the ``start_channel`` command to 20.
#. Set the end channel with the ``end_channel`` command to 60.
#. Set the time on channel with the ``time_on_channel`` command to 50 ms.
#. Set the kit in the TX sweep mode using the ``start_tx_sweep`` command.
#. Start the `RSSI Viewer app`_ and select the kit to communicate with.
#. On the application chart, observe the TX sweep in the form of a wave that starts at 2420 MHz frequency and ends with 2480 MHz.
Dependencies
************
This sample uses the following |NCS| libraries:
* :ref:`shell_ipc_readme`
* :ref:`fem_al_lib`
This sample has the following nrfx dependencies:
* :file:`nrfx/drivers/include/nrfx_timer.h`
* :file:`nrfx/hal/nrf_power.h`
* :file:`nrfx/hal/nrf_radio.h`
The sample also has the following nrfxlib dependency:
* :ref:`nrfxlib:mpsl_fem`
In addition, it uses the following Zephyr libraries:
* :ref:`zephyr:device_model_api`:
* :file:`drivers/clock_control.h`
* :ref:`zephyr:kernel_api`:
* :file:`include/init.h`
* :ref:`zephyr:shell_api`:
* :file:`include/shell/shell.h`

View File

@ -0,0 +1,6 @@
#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

View File

@ -0,0 +1,11 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/ {
chosen {
trezor,trz-uart = &uart0;
};
};

View File

@ -0,0 +1,26 @@
mcuboot:
address: 0x0
size: 0xc000
mcuboot_pad:
address: 0xc000
size: 0x200
app:
address: 0x10200
size: 0x6de00
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0xc000
size: 0x6e000
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0x10200
size: 0x6de00
settings_storage:
address: 0x7e000
size: 0x2000

View File

@ -0,0 +1,39 @@
#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_PERIOD=4000
CONFIG_CONSOLE_HANDLER=y
CONFIG_SHELL=y
CONFIG_DYNAMIC_INTERRUPTS=y
CONFIG_NRFX_TIMER0=y
CONFIG_CLOCK_CONTROL=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_NRF_SECURITY=y
CONFIG_FEM_AL_LIB=y
CONFIG_PICOLIBC_IO_FLOAT=y
CONFIG_BOOTLOADER_MCUBOOT=y
# compiler
CONFIG_DEBUG_OPTIMIZATIONS=y
# logging
CONFIG_LOG=y
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_ASSERT=y

View File

@ -0,0 +1,20 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_CONSOLE_HANDLER=y
CONFIG_SHELL=y
CONFIG_DYNAMIC_INTERRUPTS=y
CONFIG_NRFX_TIMER0=y
CONFIG_CLOCK_CONTROL=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_NRF_SECURITY=y
CONFIG_FEM_AL_LIB=y
CONFIG_RADIO_TEST_USB=y

View File

@ -0,0 +1,60 @@
sample:
description: Radio Test sample
name: Radio Test
common:
sysbuild: true
build_only: true
integration_platforms:
- t3w1_d1_nrf52833, t3w1_revA_nrf52832
tests:
sample.peripheral.radio_test:
sysbuild: true
build_only: true
integration_platforms:
- nrf52dk/nrf52832
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpunet
- nrf7002dk/nrf5340/cpunet
- nrf54l15dk/nrf54l05/cpuapp
- nrf54l15dk/nrf54l10/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
- nrf54h20dk/nrf54h20/cpurad
platform_allow: >
nrf52dk/nrf52832 nrf52840dk/nrf52840 nrf5340dk/nrf5340/cpunet nrf7002dk/nrf5340/cpunet
nrf54l15dk/nrf54l05/cpuapp nrf54l15dk/nrf54l10/cpuapp nrf54l15dk/nrf54l15/cpuapp
nrf54h20dk/nrf54h20/cpurad
tags: ci_build sysbuild ci_samples_peripheral_radio_test
sample.peripheral.radio_test.nrf5340_nrf21540:
sysbuild: true
build_only: true
extra_args: SHIELD=nrf21540ek
integration_platforms:
- nrf5340dk/nrf5340/cpunet
platform_allow: nrf5340dk/nrf5340/cpunet
tags: ci_build sysbuild ci_samples_peripheral_radio_test
sample.peripheral.radio_test.nrf5340_usb:
sysbuild: true
build_only: true
extra_args: FILE_SUFFIX=usb
integration_platforms:
- nrf5340dk/nrf5340/cpunet
platform_allow: nrf5340dk/nrf5340/cpunet
tags: ci_build sysbuild ci_samples_peripheral_radio_test
sample.peripheral.radio_test.nrf5340_nrf21540_usb:
sysbuild: true
build_only: true
extra_args: SHIELD=nrf21540ek FILE_SUFFIX=usb
integration_platforms:
- nrf5340dk/nrf5340/cpunet
platform_allow: nrf5340dk/nrf5340/cpunet
tags: ci_build sysbuild ci_samples_peripheral_radio_test
sample.peripheral.radio_test.nrf5340_nrf21540.no_automatic_power:
sysbuild: true
build_only: true
extra_args: SHIELD=nrf21540ek
extra_configs:
- CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC=n
integration_platforms:
- nrf5340dk/nrf5340/cpunet
platform_allow: nrf5340dk/nrf5340/cpunet
tags: ci_build sysbuild ci_samples_peripheral_radio_test

View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include <zephyr/sys/printk.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
#if defined(NRF54L15_XXAA)
#include <hal/nrf_clock.h>
#endif /* defined(NRF54L15_XXAA) */
#if defined(CONFIG_CLOCK_CONTROL_NRF2)
#include <hal/nrf_lrcconf.h>
#endif
#if defined(CONFIG_CLOCK_CONTROL_NRF)
static void clock_init(void)
{
int err;
int res;
struct onoff_manager *clk_mgr;
struct onoff_client clk_cli;
clk_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
if (!clk_mgr) {
printk("Unable to get the Clock manager\n");
return;
}
sys_notify_init_spinwait(&clk_cli.notify);
err = onoff_request(clk_mgr, &clk_cli);
if (err < 0) {
printk("Clock request failed: %d\n", err);
return;
}
do {
err = sys_notify_fetch_result(&clk_cli.notify, &res);
if (!err && res) {
printk("Clock could not be started: %d\n", res);
return;
}
} while (err);
#if defined(NRF54L15_XXAA)
/* MLTPAN-20 */
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTART);
#endif /* defined(NRF54L15_XXAA) */
printk("Clock has started\n");
}
#elif defined(CONFIG_CLOCK_CONTROL_NRF2)
static void clock_init(void)
{
int err;
int res;
const struct device *radio_clk_dev =
DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(DT_NODELABEL(radio)));
struct onoff_client radio_cli;
/** Keep radio domain powered all the time to reduce latency. */
nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_1, true);
sys_notify_init_spinwait(&radio_cli.notify);
err = nrf_clock_control_request(radio_clk_dev, NULL, &radio_cli);
do {
err = sys_notify_fetch_result(&radio_cli.notify, &res);
if (!err && res) {
printk("Clock could not be started: %d\n", res);
return;
}
} while (err == -EAGAIN);
#if defined(NRF54L15_XXAA)
/* MLTPAN-20 */
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTART);
#endif /* defined(NRF54L15_XXAA) */
printk("Clock has started\n");
}
#else
BUILD_ASSERT(false, "No Clock Control driver");
#endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */
int main(void)
{
printk("Starting Radio Test example\n");
clock_init();
#if defined(CONFIG_SOC_SERIES_NRF54HX)
/* Apply HMPAN-102 workaround for nRF54H series */
*(volatile uint32_t *)0x5302C7E4 =
(((*((volatile uint32_t *)0x5302C7E4)) & 0xFF000FFF) | 0x0012C000);
#endif
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,235 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#ifndef RADIO_TEST_H_
#define RADIO_TEST_H_
#include <zephyr/types.h>
#include <hal/nrf_radio.h>
#include <fem_al/fem_al.h>
#ifdef NRF53_SERIES
#ifndef RADIO_TXPOWER_TXPOWER_Pos3dBm
#define RADIO_TXPOWER_TXPOWER_Pos3dBm (0x03UL)
#endif /* RADIO_TXPOWER_TXPOWER_Pos3dBm */
#ifndef RADIO_TXPOWER_TXPOWER_Pos2dBm
#define RADIO_TXPOWER_TXPOWER_Pos2dBm (0x02UL)
#endif /* RADIO_TXPOWER_TXPOWER_Pos2dBm */
#ifndef RADIO_TXPOWER_TXPOWER_Pos1dBm
#define RADIO_TXPOWER_TXPOWER_Pos1dBm (0x01UL)
#endif /* RADIO_TXPOWER_TXPOWER_Pos1dBm */
#endif /* NRF53_SERIES */
/** Maximum radio RX or TX payload. */
#define RADIO_MAX_PAYLOAD_LEN 256
/** IEEE 802.15.4 maximum payload length. */
#define IEEE_MAX_PAYLOAD_LEN 127
/** IEEE 802.15.4 minimum channel. */
#define IEEE_MIN_CHANNEL 11
/** IEEE 802.15.4 maximum channel. */
#define IEEE_MAX_CHANNEL 26
#define FEM_USE_DEFAULT_TX_POWER_CONTROL 0xFF
/**@brief Radio transmit and address pattern. */
enum transmit_pattern {
/** Random pattern. */
TRANSMIT_PATTERN_RANDOM,
/** Pattern 11110000(F0). */
TRANSMIT_PATTERN_11110000,
/** Pattern 11001100(CC). */
TRANSMIT_PATTERN_11001100,
};
/**@brief Radio test mode. */
enum radio_test_mode {
/** TX carrier. */
UNMODULATED_TX,
/** Modulated TX carrier. */
MODULATED_TX,
/** RX carrier. */
RX,
/** TX carrier sweep. */
TX_SWEEP,
/** RX carrier sweep. */
RX_SWEEP,
/** Duty-cycled modulated TX carrier. */
MODULATED_TX_DUTY_CYCLE,
};
/**@brief Radio test front-end module (FEM) configuration */
struct radio_test_fem {
/* Front-end module radio ramp-up time in microseconds. */
uint32_t ramp_up_time;
/* Front-end module TX power control specific to given front-end module.
* For nRF21540 GPIO/SPI, this is a register value.
* For nRF21540 GPIO, this is MODE pin value.
*/
fem_tx_power_control tx_power_control;
};
/**@brief Radio test configuration. */
struct radio_test_config {
/** Radio test type. */
enum radio_test_mode type;
/** Radio mode. Data rate and modulation. */
nrf_radio_mode_t mode;
union {
struct {
/** Radio output power. */
int8_t txpower;
/** Radio channel. */
uint8_t channel;
} unmodulated_tx;
struct {
/** Radio output power. */
int8_t txpower;
/** Radio transmission pattern. */
enum transmit_pattern pattern;
/** Radio channel. */
uint8_t channel;
/**
* Number of packets to transmit.
* Set to zero for continuous TX.
*/
uint32_t packets_num;
/** Callback to indicate that TX is finished. */
void (*cb)(void);
} modulated_tx;
struct {
/** Radio transmission pattern. */
enum transmit_pattern pattern;
/** Radio channel. */
uint8_t channel;
/**
* Number of packets to be received.
* Set to zero for continuous RX.
*/
uint32_t packets_num;
/** Callback to indicate that RX is finished. */
void (*cb)(void);
} rx;
struct {
/** Radio output power. */
int8_t txpower;
/** Radio start channel (frequency). */
uint8_t channel_start;
/** Radio end channel (frequency). */
uint8_t channel_end;
/** Delay time in milliseconds. */
uint32_t delay_ms;
} tx_sweep;
struct {
/** Radio start channel (frequency). */
uint8_t channel_start;
/** Radio end channel (frequency). */
uint8_t channel_end;
/** Delay time in milliseconds. */
uint32_t delay_ms;
} rx_sweep;
struct {
/** Radio output power. */
int8_t txpower;
/** Radio transmission pattern. */
enum transmit_pattern pattern;
/** Radio channel. */
uint8_t channel;
/** Duty cycle. */
uint32_t duty_cycle;
} modulated_tx_duty_cycle;
} params;
#if CONFIG_FEM
/* Front-end module (FEM) configuration. */
struct radio_test_fem fem;
#endif /* CONFIG_FEM */
};
/**@brief Radio RX statistics. */
struct radio_rx_stats {
/** Content of the last packet. */
struct {
/** Content of the last packet. */
uint8_t *buf;
/** Length of the last packet. */
size_t len;
} last_packet;
/** Number of received packets with valid CRC. */
uint32_t packet_cnt;
};
/**
* @brief Function for initializing the Radio Test module.
*
* @param[in] config Radio test configuration.
*
* @retval 0 If the operation was successful.
* Otherwise, a (negative) error code is returned.
*/
int radio_test_init(struct radio_test_config *config);
/**
* @brief Function for starting radio test.
*
* @param[in] config Radio test configuration.
*/
void radio_test_start(const struct radio_test_config *config);
/**
* @brief Function for stopping ongoing test (Radio and Timer operations).
*/
void radio_test_cancel(void);
/**
* @brief Function for get RX statistics.
*
* @param[out] rx_stats RX statistics.
*/
void radio_rx_stats_get(struct radio_rx_stats *rx_stats);
/**
* @brief Function for toggling the DC/DC converter state.
*
* @param[in] dcdc_state DC/DC converter state.
*/
void toggle_dcdc_state(uint8_t dcdc_state);
#endif /* RADIO_TEST_H_ */

View File

@ -0,0 +1,32 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
get_property(PM_DOMAINS GLOBAL PROPERTY PM_DOMAINS)
# Include app core image if enabled
if(SB_CONFIG_SOC_NRF5340_CPUNET AND NOT SB_CONFIG_BOARD_NRF7002DK)
# Get application core board target
string(REPLACE "/" ";" split_board_qualifiers "${BOARD_QUALIFIERS}")
list(GET split_board_qualifiers 1 target_soc)
set(board_target_appcore "${BOARD}/${target_soc}/cpuapp")
set(target_soc)
ExternalZephyrProject_Add(
APPLICATION remote_shell
SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/samples/nrf5340/remote_shell
BOARD ${board_target_appcore}
BOARD_REVISION ${BOARD_REVISION}
)
if(NOT "CPUAPP" IN_LIST PM_DOMAINS)
list(APPEND PM_DOMAINS CPUAPP)
endif()
set_property(GLOBAL APPEND PROPERTY PM_CPUAPP_IMAGES "remote_shell")
set_property(GLOBAL PROPERTY DOMAIN_APP_CPUAPP "remote_shell")
set(CPUAPP_PM_DOMAIN_DYNAMIC_PARTITION remote_shell CACHE INTERNAL "")
endif()
set_property(GLOBAL PROPERTY PM_DOMAINS ${PM_DOMAINS})

View File

@ -0,0 +1,9 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Enable MCUboot
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y

View File

@ -0,0 +1,33 @@
#CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_PERIOD=4000
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_NRFX=y
#CONFIG_UART_INTERRUPT_DRIVEN=n
# MCUBoot serial
CONFIG_GPIO=y
CONFIG_GPIO_NRFX_INTERRUPT=n
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_MGMT_ECHO=y
CONFIG_BOOT_SERIAL_CDC_ACM=y
CONFIG_BOOT_SERIAL_UART=y
#CONFIG_LOG_BACKEND_UART=y
#CONFIG_BOOT_SERIAL_DETECT_PIN=11
#CONFIG_MCUMGR_SMP_UART=y
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
CONFIG_SINGLE_APPLICATION_SLOT=y
CONFIG_BOOT_VALIDATE_SLOT0=y
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_UART_CONSOLE=n

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/ {
chosen {
zephyr,shell-ipc = &ipc0;
ncs,remote-shell-uart = &uart0;
};
};
&uart0 {
status = "okay";
};

View File

@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include "usb.dts"

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/ {
chosen {
zephyr,shell-ipc = &ipc0;
ncs,remote-shell-uart = &cdc_acm0;
};
};
&zephyr_udc0 {
cdc_acm0: cdc_acm0 {
compatible = "zephyr,cdc-acm-uart";
};
};
&uart0 {
status = "disabled";
};

View File

@ -0,0 +1,30 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_STDOUT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_RING_BUFFER=y
CONFIG_MBOX=y
CONFIG_IPC_SERVICE=y
CONFIG_IPC_SERVICE_BACKEND_RPMSG=y
CONFIG_NRFX_UARTE0=y
CONFIG_HEAP_MEM_POOL_SIZE=4096
# Config logger
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_REMOTE_SHELL_TX_RING_BUFFER_SIZE=1024
CONFIG_SOC_NRF53_CPUNET_ENABLE=y

View File

@ -0,0 +1,34 @@
#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_MBOX=y
CONFIG_IPC_SERVICE=y
CONFIG_IPC_SERVICE_BACKEND_RPMSG=y
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Nordic Remote Shell sample"
CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x53AA
# Config logger
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_SOC_NRF53_CPUNET_ENABLE=y