Bluetooth: Channel Sounding Initiator with Ranging Requestor
This sample demonstrates how to use the ranging service to request ranging data from a server. Distance estimates are then computed from the ranging data and logged to the terminal.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
nRF54LV10 DK |
PCA10188 |
|
|
PCA10184 |
|
||
nRF54LC10 DK |
PCA10226 |
nrf54lc10dk |
|
PCA10156 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10175 |
|
The sample also requires a device running a Channel Sounding Reflector with Ranging Responder to connect to, such as the Bluetooth: Channel Sounding Reflector with Ranging Responder sample.
Overview
The sample demonstrates a basic Bluetooth® Low Energy Central role functionality that acts as a GATT Ranging Requestor client and configures the Channel Sounding initiator role. Regular Channel Sounding procedures are set up, local subevent data is stored, and peer ranging data is fetched.
User interface
The sample does not require user input and will scan for a device advertising with 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_initiator 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 Reflector role with Ranging Responder, such as the Bluetooth: Channel Sounding Reflector with Ranging Responder sample.
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.
Reset both kits.
Wait until the scanner detects the Peripheral. In the terminal window, check for information similar to the following:
I: Starting Channel Sounding Initiator Sample I: SoftDevice Controller build revision: I: bd 8a c7 d2 9b 7c 24 05 |.....|$. I: d3 20 24 a2 60 b9 62 44 |. $.`.bD I: 1a dc cc 22 |..." I: HW Platform: Nordic Semiconductor (0x0002) I: HW Variant: nRF54Lx (0x0005) I: Firmware: Standard Bluetooth controller (0x00) Version 189.51082 Build 612146130 I: Identity: XX:XX:XX:XX:XX:XX (random) I: HCI: version 6.0 (0x0e) revision 0x30d5, manufacturer 0x0059 I: LMP: version 6.0 (0x0e) subver 0x30d5 I: Filters matched. Address: XX:XX:XX:XX:XX:XX (random) connectable: 1 I: Connecting I: Connected to XX:XX:XX:XX:XX:XX (random) (err 0x00) I: Security changed: XX:XX:XX:XX:XX:XX (random) level 2 I: MTU exchange success (498) I: The discovery procedure succeeded I: CS capability exchange completed. I: CS config creation complete. ID: 0 I: CS security enabled. I: CS procedures enabled: - config ID: 0 - antenna configuration index: 0 - TX power: 0 dbm - subevent length: 28198 us - subevents per event: 1 - subevent interval: 0 - event interval: 2 - procedure interval: 10 - procedure count: 0 - maximum procedure length: 1000 I: Distance estimates on antenna path 0: ifft: 1.039173, phase_slope: 1.581897, rtt: 3.075647 I: Sleeping for a few seconds...
Dependencies
This sample uses the following nRF Connect SDK libraries:
include/bluetooth/gatt_dm.hinclude/bluetooth/services/ras.h
This sample uses the following Zephyr libraries:
include/sys/printk.hinclude/zephyr/types.h-
include/kernel.h
API:
include/bluetooth/bluetooth.hinclude/bluetooth/conn.hinclude/bluetooth/cs.h