Enhanced ShockBurst: Transmitter

The Enhanced ShockBurst Transmitter sample shows the basic steps that are needed to transmit and receive packets using Enhanced ShockBurst (ESB).

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

Shields

nRF54L15 PDK

PCA10156

nrf54l15pdk

nrf54l15pdk/nrf54l15/cpuapp

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpurad

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpunet

nrf21540ek

nRF52 DK

PCA10040

nrf52dk

nrf52dk/nrf52832

nRF52 DK (emulating nRF52810)

PCA10040

nrf52dk

nrf52dk/nrf52810

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

nRF52833 DK

PCA10100

nrf52833dk

nrf52833dk/nrf52833

nRF21540 DK

PCA10112

nrf21540dk

nrf21540dk/nrf52840

Additionally, if you want to test the Enhanced ShockBurst Receiver functionality, you need to build and run the Enhanced ShockBurst: Receiver sample. You can use any two of the development kits listed above and mix different development kits.

Overview

The sample consists of a Transmitter that uses the Enhanced ShockBurst library. After building and programming each sample on an nRF52 Series development kit, you can test that packets that are sent by the kit that runs the Transmitter sample are picked up by the kit that runs the Receiver sample. Successful communication is indicated by LED changes, which should be in sync on both kits.

The Transmitter sends a packet, waits for a configurable time (50 milliseconds by default), and then sends another packet. The LEDs indicate that packets were sent and acknowledged. Therefore, if packets are successfully received and acknowledged by the Receiver, the LED pattern changes every 50 milliseconds (with the default delay).

User interface

All LEDs:

Indicate that packets are sent or received. The first four packets turn on the LEDs sequentially. The next four packets turn them off again in the same order.

Configuration

See Configuring and building for information about how to permanently or temporarily change the configuration.

Building and running

The Transmitter sample can be found under samples/esb/esb_ptx in the nRF Connect SDK folder structure.

See Building an application and Programming an application for information about how to build and program the application, respectively.

Note

Programming the nRF54H20 SoC can sometimes fail due to conflicts in the resource configuration. This can happen if, for example, an application programmed to the nRF54H20 SoC configured the UICRs for one or more cores in a way that is incompatible with the configuration required by the application you are trying to program on the SoC.

To fix this error and erase the UICR for the application core, run the following command:

nrfutil device recover --core Application

If your sample also uses the radio core, you must also erase the UICRs for the radio core. To erase the UICR for the radio core, run the following command:

nrfutil device recover --core Network

For more information on the command, run:

nrfutil device recover --help

You can then run west flash to program your application.

FEM support

You can add support for the nRF21540 front-end module to this sample by using one of the following options, depending on your hardware:

  • Build the sample for one board that contains the nRF21540 FEM, such as nrf21540dk/nrf52840.

  • Manually create a devicetree overlay file that describes how the nRF21540 FEM is connected to the SoC. See Configuring devicetree for different ways of adding the overlay file.

  • Provide nRF21540 FEM capabilities by using a shield, for example the nRF21540 EK shield that is available in the nRF Connect SDK. In this case, build the project for a board connected to the shield you are using with an appropriate variable included in the build command, for example -DSHIELD=nrf21540ek. This variable instructs the build system to append the appropriate devicetree overlay file.

    To build the sample in the nRF Connect for VS Code extension for an nRF52840 DK with the nRF21540 EK attached, add the shield variable in the build configuration’s Extra CMake arguments and rebuild the build configuration. For example: -DSHIELD=nrf21540ek.

    See How to work with build configurations in the nRF Connect for VS Code extension documentation for more information.

    See Programming nRF21540 EK for information about how to program when you are using a board with a network core, for example the nRF5340 DK.

Each of these options adds the description of the nRF21540 FEM to the devicetree. See Developing with Front-End Modules for more information about FEM in the nRF Connect SDK.

To add support for other front-end modules, add the respective devicetree file entries to the board devicetree file or the devicetree overlay file.

Testing

After programming the Transmitter sample on one of the development kits and the Receiver sample on the other kit, you can test their functionality.

Complete the following steps to test both the Transmitter and Receiver samples:

  1. Power on both kits.

  2. Observe that the LEDs change synchronously on both kits.

  3. Optionally, connect to the kits with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  4. Observe the logging output for both kits.

Dependencies

This sample uses the following nRF Connect SDK library:

In addition, it uses the following Zephyr libraries: