Enhanced ShockBurst: Transmitter/Receiver

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

Overview

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

Transmitter

The Transmitter example sends a packet, waits for a configurable time (50 milliseconds by default), and then sends another packet. In each packet, the four least significant bits of the first byte of the payload are incremented (or reset to zero when they reach 16). The LEDs indicate that packets were sent and acknowledged. Therefore, if packets are successfully received and acknowledged by the Receiver, the LED pattern will change every 50 milliseconds (with the default delay).

Receiver

The Receiver example listens for packets and sends an ACK when a packet is received. If packets are successfully received from the transmitter, the LED pattern will change every time a packet is received.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF21540 DK

PCA10112

nrf21540dk_nrf52840

nrf21540dk_nrf52840

You can use any two of the development kits listed above and mix different development kits.

Configuration

See Configuring your application for information about how to permanently or temporarily change the configuration.

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 FEM is connected to the nRF5 SoC in your device. See Set devicetree overlays 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. This variable instructs the build system to append the appropriate devicetree overlay file. For example, to build the sample from the command line for an nRF52833 DK with the nRF21540 EK attached, use the following command within the sample directory:

    west build -b nrf52833dk_nrf52833 -- -DSHIELD=nrf21540_ek
    

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

Each of these options adds the description of the nRF21540 FEM to the devicetree. See Working with RF 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.

User interface

LED 1-4:

Indicate that packets are sent or received. The first four packets turn on LED 1, 2, 3, and 4. The next four packets turn them off again in the same order.

Building and running

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

See Building and programming an application for information about how to build and program the application.

Testing

After programming the Transmitter sample on one of the development kits and the Receiver sample on the other kit, test them by performing the following steps:

  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, PuTTY). See How to connect with PuTTY for the required settings.

  4. Observe the logging output for both kits.

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries: