nRF5 SDK v15.3.0
Experimental: Heart Rate Application with BLE Pairing Using NFC Pairing Library
This example requires the following SoftDevice: S132

Important: Before you run this example, make sure to program the SoftDevice.

This example is based on the BLE Peripheral Heart Rate Application example. It implements the Heart Rate profile and enables pairing from a BLE Central device using the NFC interface. To do the pairing, it uses the NFC tag module, which is one of the nRF52 peripherals, and the NFC antenna that is delivered with the nRF52 Development Kit.

The application shows the usage of the NFC BLE pairing library. It includes the same services that are present in the original Heart Rate Application example. See the documentation for that example for details. The following description presents only the differences from the original example.

When the application starts, it initializes and starts the NFCT peripheral, which is used for pairing. The application does not start advertising immediately, but only when the NFC tag is read by an NFC polling device, for example a smartphone or a tablet with NFC support. The message that the tag sends to the NFC device contains data required to initiate pairing. To start the NFC data transfer, the NFC device must touch the NFC antenna that is connected to the nRF52 Development Kit.

After reading the tag, the device can pair with the nRF52 device which is advertising. After connecting, the example application behaves in the same way as the original HRS example with one difference. The security level for Heart Rate Measurement CCCD has been raised to the highest possible level - level 4, so that it is possible for the central device to turn on HRM notifications only after a proper pairing procedure. When the connection is lost due to timeout, the library automatically triggers direct advertising.

This example demonstrates the use of Low Energy Secure Connections (LESC). The default cryptographic backend used for LESC is CC310 (when run on nRF52840) or Oberon (for other SoCs). To use micro-ecc instead, follow the steps in Enabling micro-ecc support in selected examples.

Note
This application is not power optimized!

Setup

Since the SoftDevice does not include the functionality required to calculate Elliptic Curve Cryptography (ECC) public keys and shared secrets, an external library is required for this purpose. Bindings and build files are provided for a well-known open source library, micro-ecc, although the library itself is not provided.

To use micro-ecc with this project, follow the steps described in Installing micro-ecc.

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\experimental_ble_app_hrs_nfc_pairing

Button assignments: BSP BLE Button Assignments

Testing

Test the Heart Rate Sensor Application with BLE pairing using NFC with a smartphone or tablet that supports NFC. It can also be tested with the complementary Heart Rate Collector Application example, that uses the Adafruit PN532 NFC Shield. Perform the following steps:

  1. Choose the proper NFC pairing mode and Peer Manager security parameters settings in the SDK configuration header file.
  2. Compile and program the application.
  3. Touch the NFC antenna with the smartphone, tablet, or the complementary central device example and observe that the BSP_INDICATE_ADVERTISING state is indicated. LED 4 is lit when the NFC tag detects the NFC field.
  4. Confirm pairing with 'Nordic_HRM_NFC' in a pop-up window on the smartphone/tablet (HRS central example will connect automatically) and observe that the BSP_INDICATE_CONNECTED state is indicated.
  5. Test the Heart Rate Application using the nRF Connect app.

Documentation feedback | Developer Zone | Subscribe | Updated