The Radio Test Example demonstrates how to configure the radio as the constant RX or TX carrier, the modulated TX carrier, or the RX or TX sweep.
The tests are controlled with Command Line Interface (CLI) by the serial port. At any time during the tests, you can set the radio parameters output power, bit rate, and channel. You can also set the time on each channel in the sweep mode, in steps of 1 millisecond to 99 milliseconds, every 1 millisecond. The application also allows you to send a data pattern to another board.
The application starts with enabling the high frequency crystal oscillator and configuring CLI. Calling a console command causes the appropriate action.
- 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.
CLI commands
The following table lists the available main CLI commands, in alphabetical order.
| Command | Argument | Description |
|---|---|---|
cancel
|
Cancel the sweep or the carrier. | |
data_rate
|
<sub_cmd>
|
Set the data rate. |
end_channel
|
<channel>
|
End the channel for the sweep. |
output_power
|
<sub_cmd>
|
Output power set. |
parameters_print
|
Print current delay, channel, and other parameters. | |
print_rx
|
Print the received RX payload. | |
start_channel
|
<channel>
|
Start the channel for the sweep or the channel for the constant carrier. |
start_duty_cycle_modulated_tx
|
<duty_cycle>
|
Duty cycle in percent (two decimal digits, between 01 and 99). |
start_rx
|
Start RX. | |
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 (between 1 ms and 99 ms). |
toggle_dcdc_state
|
<state>
|
Toggle DC/DC converter state. |
transmit_pattern
|
<sub_cmd>
|
Set transmission pattern. |
You can find the source code and the project file of the example in the following folder:
<InstallFolder>\examples\peripheral\radio_test
Using the Radio Test API
The Radio Test Example includes the
radio_test.h
file, which includes API declarations that were added or modified in the nRF5 SDK v17.0.0.
To create a custom application that directly uses this Radio Test API, make sure that your application:
-
Calls the initialization function,
radio_test_init(). -
Creates and fills in the test configuration structure of type
radio_test_config_t.- Note
-
Make sure that the
radio_test_mode_tenumerator'stypefield is set to the test type of your choice.
-
Calls the function
radio_test_start()to start the test. -
Calls the function
radio_test_cancel()to stop the running test.
You can use this approach for running a single radio test or for maintaining custom automated setup for your RF tests that were created before the release of the nRF5 SDK v17.0.0. This does not however replace the need of porting your application to the Radio Test API definitions from the latest version.
Testing
You can test this application with one of the following methods:
- by using a spectrum analyzer, or
- by using a second board with the same example.
- Note
- When using a second board, both boards must have the same radio mode, channel, and transmission pattern to receive data. Receiving data is not possible in a random transmission pattern.
Test the Radio Test Example application by performing the following steps:
- Compile and program the application.
- Start a terminal emulator like PuTTY (recommended) with the related Terminal settings and UART and USB settings . The text "Radio test example started." appears at the top of the terminal.
- Open a serial connection to the COM port used by the tester board. A command prompt is displayed.
- Type any of the CLI commands described above. An output text is displayed in the terminal emulator window, and the sweep or the signal is started.
-
Depending on the testing method:
- Use a spectrum analyzer to confirm the behavior of the radio module.
-
Use a second board configured in the same mode as the first one to receive the transmission, and type
print_rxto print the RX data received from the other board.
If you use the spectrum analyzer, the testing is successful when the spectrum is displayed correctly.
If you use two boards, the testing is successful when the data is displayed correctly.
If the spectrum or the data does not display correctly, verify the configuration.