Bluetooth: Peripheral Heart Rate Monitor with Coded PHY
The Peripheral Heart Rate Monitor with Coded PHY offers similar functionality to the Heart-rate Monitor (Peripheral) sample from Zephyr. However, this sample supports LE Coded PHY.
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 |
|
||
PCA10095 |
|
||
PCA10056 |
|
The sample also requires a device running a Heart Rate Server with LE Coded PHY support to connect to. For example, another development kit running the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
Overview
The sample demonstrates a basic Bluetooth® Low Energy Peripheral role functionality that exposes the Heart Rate GATT Service with LE Coded PHY support, which is not available in Zephyr Bluetooth LE Controller (See Controller for more information).
Once it connects to a Central device, it generates dummy heart rate values.
You can use it together with the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
The sample enables the CONFIG_BT_EXT_ADV_CODING_SELECTION Kconfig option to use the Advertising Coding Selection feature to explicitly set the required coding scheme for LE Coded PHY.
The advertiser is configured to use the S=8 coding scheme, but you can change or remove it through the advertising options, depending on the application’s needs.
User interface
The user interface of the sample depends on the hardware platform you are using.
- LED 1:
Blinks, toggling on/off every second, when the main loop is running and the device is advertising.
- LED 2:
Lit when the development kit is connected.
- LED 0:
Blinks, toggling on/off every second, when the main loop is running and the device is advertising.
- LED 1:
Lit when the development kit is connected.
Building and running
This sample can be found under samples/bluetooth/peripheral_hr_coded 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.
When building this sample with Sysbuild for an SoC that has a network core, the IPC radio firmware is automatically applied to the build.
The IPC radio is one of the companion components in the nRF Connect SDK and allows to use the radio peripheral from another core in a multicore device.
If needed, you can modify the IPC radio configuration in the prj.conf source file in the sample’s sysbuild/ipc_radio directory.
Testing
After programming the sample to your development kit, you can test it by connecting to another development kit that runs the Bluetooth: Central Heart Rate Monitor with Coded PHY.
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 the kit.
Program the other kit with the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
Wait until the Coded advertiser is detected by the Central. In the terminal window, check for information similar to the following:
Connected: xx.xx.xx.xx.xx.xx (random), tx_phy LE Coded, rx_phy LE Coded
In the terminal window, observe that notifications are enabled:
<inf> hrs: HRS notifications enabled
Dependencies
This sample uses the following nRF Connect SDK library:
This sample uses the following Zephyr libraries:
include/zephyr/types.hinclude/errno.hinclude/zephyr.hinclude/sys/printk.hinclude/sys/byteorder.h-
include/kernel.h
API:
include/bluetooth/bluetooth.hinclude/bluetooth/conn.hinclude/bluetooth/uuid.hinclude/bluetooth/gatt.hinclude/bluetooth/services/bas.hinclude/bluetooth/services/hrs.h