Bluetooth: Peripheral Heart Rate Monitor with Coded PHY

The Peripheral Heart Rate Monitor with Coded PHY offers similar functionality to the Bluetooth: Peripheral HR sample from Zephyr. However, this sample supports LE Coded PHY.

Overview

The sample demonstrates a basic Bluetooth LE Peripheral role functionality that exposes the Heart Rate GATT Service with LE Coded PHY support. Once it connects to a Central device, it generates dummy heart rate values. It can be used together with the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuappns

nRF52840 Dongle

PCA10059

nrf52840dongle_nrf52840

nrf52840dongle_nrf52840

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

The sample also requires:

Building and Running

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

See Building and programming a sample application for information about how to build and program the application.

Testing

After programming the sample to your board, you can test it by connecting to another board that runs the Bluetooth: Central Heart Rate Monitor with Coded PHY.

  1. Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

  2. Reset the board.

  3. Program the other board with the Bluetooth: Central Heart Rate Monitor with Coded PHY.

  4. 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 4, rx_phy 4
    
  5. In the terminal window, observe that notifications are enabled:

    <inf> hrs: HRS notifications enabled
    

Dependencies

This sample uses the following Zephyr libraries:

  • include/zephyr/types.h

  • include/errno.h

  • include/zephyr.h

  • include/sys/printk.h

  • include/sys/byteorder.h

  • Kernel Services:

    • include/kernel.h

  • Bluetooth:

  • include/bluetooth/bluetooth.h

  • include/bluetooth/conn.h

  • include/bluetooth/uuid.h

  • include/bluetooth/gatt.h

  • include/bluetooth/services/bas.h

  • include/bluetooth/services/hrs.h