Enhanced ShockBurst: Transmitter with Bluetooth LE
The sample shows how to use the Enhanced ShockBurst (ESB) protocol in transmitter mode concurrently with Bluetooth® LE protocol. It demonstrates how to configure the Enhanced ShockBurst protocol to transmit packets while simultaneously running Bluetooth LE services.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
nRF54LV10 DK |
PCA10188 |
|
|
nRF54LS05 DK |
PCA10214 |
nrf54ls05dk |
|
PCA10184 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10175 |
|
||
PCA10040 |
|
||
PCA10056 |
|
||
PCA10100 |
|
Additionally, if you want to fully test the Enhanced ShockBurst Transmitter functionality, you need to build and run the Enhanced ShockBurst: Receiver sample. You can use any two of the listed development kits and mix different development kits.
Overview
The sample consists of one Transmitter that uses the Enhanced ShockBurst library in combination with Bluetooth LE functionality. After building and programming the sample on a development kit, you can test that packets that are sent by the Transmitter sample are picked up by the Receiver sample. Successful communication is indicated by LED changes.
The Transmitter sends a packet, waits for a configurable time (100 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 100 milliseconds (with the default delay).
The sample demonstrates cooperative operation between ESB and Bluetooth LE protocols using the MPSL (Multiprotocol Service Layer) time slot mechanism. This mechanism allows both protocols to share radio time without interference. The sample runs the LED Button Service (LBS) alongside the ESB transmitter functionality, enabling simultaneous wireless communication using both protocols. This LBS functionality is used to transmit the button state to connected BLE device and remotely control the LED on your development kit from connected BLE device.
User interface
- LED 1:
Lit when the development kit is connected to BLE device.
- LED 2:
Lit when the development kit is controlled remotely from the connected BLE device.
- LED 3 and LED 4:
Indicate that packets are sent. The first two packets turn on the LEDs sequentially. The next two packets turn them off again in the same order.
- Button 1:
Send a notification with the button state: “pressed” or “released”.
- LED 0:
Lit when the development kit is connected.
- LED 1:
Lit when the development kit is controlled remotely from the connected device.
- LED 2 and LED 3:
Indicate that packets are sent. The first two packets turn on the LEDs sequentially. The next two packets turn them off again in the same order.
- Button 0:
Send a notification with the button state: “pressed” or “released”.
Configuration
See Configuring and building for information about how to permanently or temporarily change the configuration.
Building and running
The Transmitter sample is located under samples/esb/esb_ptx_ble 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.
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 nRF21540 DK.
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 nRF Connect for VS Code 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 documentation for more information.
To build the sample from the command line for an nRF52840 DK with the nRF21540 EK attached, use the following command within the sample directory:
west build -b nrf52840dk/nrf52840 -- -DSHIELD=nrf21540ekSee 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
This sample combines ESB transmitter functionality with Bluetooth LE LBS service, and both protocols can be tested independently.
Testing ESB functionality
To test the ESB transmitter functionality, follow the procedure described in the Testing section. In brief, you need to program the Enhanced ShockBurst: Receiver sample on another development kit and observe that the LEDs change synchronously on both kits as packets are transmitted and received.
Testing LBS service
To test the Bluetooth LE LBS service functionality, follow the procedure described in the Testing section.
You can use a smartphone or tablet with the nRF Connect for Mobile or nRF Blinky application to connect to the device (advertising as Nordic_LBS), control the LED remotely, and receive button press notifications.
Dependencies
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
include/zephyr/types.h-
include/kernel.hinclude/irq.h
-
include/gpio.h
API:
include/bluetooth/bluetooth.hinclude/bluetooth/hci.hinclude/bluetooth/conn.hinclude/bluetooth/uuid.hinclude/bluetooth/gatt.h