Bluetooth: Radio Notification callback

This sample demonstrates how to use the Radio Notification callback feature. It uses the GATT Latency Service and the GATT Latency Client to showcase how you can use this feature to minimize the time between data sampling and data transmission.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF54L15 PDK

PCA10156

nrf54l15pdk

nrf54l15pdk/nrf54l15/cpuapp

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpurad

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpunet

nRF52 DK

PCA10040

nrf52dk

nrf52dk/nrf52832

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

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

Additionally, the sample requires a connection to a computer with a serial terminal for each of the development kits.

Note

The feature involves triggering a (D)PPI task directly from the SoftDevice Controller link layer. The application and SoftDevice Controller are supposed to be running on the same core.

Building and running

This sample can be found under samples/bluetooth/radio_notification_cb in the nRF Connect SDK folder structure.

To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

Testing

After programming the sample to both development kits, perform the following steps to test it:

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

  2. Reset both kits.

  3. In one of the terminal emulators, type c to start the application on the connected board in the central role.

  4. In the other terminal emulator, type p to start the application in the peripheral role.

  5. Observe that latency measurements are printed in the terminals.

Sample output

The result should look similar to the following output.

For the central:

Starting radio notification callback sample.
I: SoftDevice Controller build revision:
I: d6 da c7 ae 08 db 72 6f |......ro
I: 2a a3 26 49 2a 4d a8 b3 |*.&I*M..
I: 98 0e 07 7f             |....
I: HW Platform: Nordic Semiconductor (0x0002)
I: HW Variant: nRF52x (0x0002)
I: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
I: Identity: FA:BB:79:57:D6:45 (random)
I: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
I: LMP: version 5.4 (0x0d) subver 0x11fb
Choose device role - type c (central) or p (peripheral):
Central. Starting scanning
Scanning started
Device found: CF:99:32:A5:4B:11 (random) (RSSI -43)
Connected: CF:99:32:A5:4B:11 (random)
Service discovery completed
Latency: 3771 us, round trip: 53771 us
Latency: 3741 us, round trip: 53741 us
Latency: 3741 us, round trip: 53741 us
Latency: 3741 us, round trip: 53741 us
Latency: 3771 us, round trip: 53771 us
Latency: 3771 us, round trip: 53771 us
Latency: 3741 us, round trip: 53741 us
Latency: 3741 us, round trip: 53741 us
Latency: 3741 us, round trip: 53741 us
Latency: 3771 us, round trip: 53771 us
Latency: 3771 us, round trip: 53771 us
Latency: 3741 us, round trip: 53741 us
Latency: 3741 us, round trip: 53741 us

For the peripheral:

Starting radio notification callback sample.
I: SoftDevice Controller build revision:
I: d6 da c7 ae 08 db 72 6f |......ro
I: 2a a3 26 49 2a 4d a8 b3 |*.&I*M..
I: 98 0e 07 7f             |....
I: HW Platform: Nordic Semiconductor (0x0002)
I: HW Variant: nRF52x (0x0002)
I: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
I: Identity: CF:99:32:A5:4B:11 (random)
I: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
I: LMP: version 5.4 (0x0d) subver 0x11fb
Choose device role - type c (central) or p (peripheral):
Peripheral. Starting advertising
Advertising started
Connected: FA:BB:79:57:D6:45 (random)
Service discovery completed
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3619 us, round trip: 53619 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3619 us, round trip: 53619 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us
Latency: 3649 us, round trip: 53649 us

Dependencies

This sample uses the following nRF Connect SDK libraries:

This sample uses the following sdk-nrfxlib libraries:

In addition, it uses the following Zephyr libraries:

  • include/console.h

  • Kernel Services:

    • include/kernel.h

  • include/sys/printk.h

  • include/zephyr/types.h

  • API:

    • include/bluetooth/bluetooth.h

    • include/bluetooth/conn.h

    • include/bluetooth/gatt.h

    • include/bluetooth/scan.h

    • include/bluetooth/gatt_dm.h

    • include/bluetooth/evt_cb.h