Bluetooth: Channel Sounding Reflector with Ranging Responder

This sample demonstrates how to use the ranging service to provide ranging data to a client.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF54LV10 DK

PCA10188

nrf54lv10dk

nrf54lv10dk/nrf54lv10a/cpuapp/ns nrf54lv10dk/nrf54lv10a/cpuapp

nRF54LM20 DK

PCA10184

nrf54lm20dk

nrf54lm20dk/nrf54lm20b/cpuapp nrf54lm20dk/nrf54lm20a/cpuapp

nRF54LC10 DK

PCA10226

nrf54lc10dk

nrf54lc10dk/nrf54lc10a/cpuapp/ns nrf54lc10dk/nrf54lc10a/cpuapp

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF54L15 DK (emulating nRF54L10)

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l10/cpuapp

nRF54L15 DK (emulating nRF54L05)

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l05/cpuapp

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

The sample also requires a device running a Channel Sounding Initiator with Ranging Requestor to connect to, such as the Bluetooth: Channel Sounding Initiator with Ranging Requestor sample.

Overview

The sample demonstrates a basic Bluetooth® Low Energy Peripheral role functionality that exposes the GATT Ranging Responder Service and configures the Channel Sounding reflector role. When Channel Sounding Ranging Data is generated by the controller, it will be automatically stored by the Ranging Service, and can be queried at any time by the Ranging Requestor. The Channel Sounding Ranging Data can then be used by the peer device to perform distance estimation.

User interface

The sample does not require user input and will advertise using the GATT Ranging Service UUID. The first LED on the development kit will be lit when a connection has been established.

Building and running

This sample can be found under samples/bluetooth/channel_sounding/ras_reflector 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 your development kit, you can test it by connecting to another device programmed with a Channel Sounding Initiator role with Ranging Requestor, such as the Bluetooth: Channel Sounding Initiator with Ranging Requestor sample.

  1. Connect to the kit that runs this sample with a terminal emulator (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.

  2. Reset the kit.

  3. Wait until the advertiser is detected by the Central. In the terminal window, check for information similar to the following:

    I: Connected to xx.xx.xx.xx.xx.xx (random) (err 0x00)
    I: CS capability exchange completed.
    I: CS config creation complete. ID: 0
    I: CS security enabled.
    I: CS procedures enabled.
    

Building for testing with Android 16 ranging module

In order to enable Bluetooth configurations required to test Channel sounding with Android 16 phones with Channel sounding support, the android_ranging.conf fragment can be applied. For example, using the following command:

west build -bnrf54l15dk/nrf54l15/cpuapp -- -DEXTRA_CONF_FILE="android_ranging.conf"

Dependencies

This sample uses the following nRF Connect SDK libraries:

This sample uses the following Zephyr libraries:

  • Logging:

    • include/logging/log.h

  • include/zephyr/types.h

  • Kernel Services:

    • include/kernel.h

  • API:

  • include/bluetooth/bluetooth.h

  • include/bluetooth/conn.h

  • include/bluetooth/uuid.h

  • include/bluetooth/cs.h