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. When the connection is lost due to timeout, the library automatically triggers direct advertising.
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 Software backend (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
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: