nRF5 SDK v15.3.0
Experimental: BLE Pairing Using NFC - Peripheral Reference Example
This example requires the following SoftDevice: S132

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

The aim of this example is to provide a reference BLE Peripheral application that presents the BLE Connection Handover pairing using an NFC tag. This application also shows the usage of the NFC BLE pairing library. The example can be used to test the touch-to-pair feature with BLE Central devices that embed an NFC reader. You can also find a complementary BLE Central example in this SDK that can be used with the application for BLE Connection Handover pairing.

To simplify the pairing tests, this application uses minimal BLE functionalities. It does not have any GATT services. It allows to perform pairing in one of three different modes:

The pairing mode can be chosen by pressing buttons on the device. For more information on BLE Connection Handover pairing, refer to the NFC Forum Application Document Bluetooth Secure Simple Pairing Using NFC.

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. Connection state of the device is signalled by LEDs. 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.

This application is not power optimized!


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_nfc_pairing_reference

Button assignments:

You can use buttons to switch between pairing modes:


Test this application with a smartphone or tablet that supports NFC. It can also be tested with the complementary BLE Central example that uses the Adafruit PN532 NFC Shield. Perform the following steps:

  1. Compile and program the application.
  2. Use buttons to choose the proper pairing mode.
  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_NFC_PAIR_REF' in a pop-up window on the smartphone or tablet (the BLE Central example will connect automatically) and observe that the BSP_INDICATE_CONNECTED state is indicated.

Documentation feedback | Developer Zone | Subscribe | Updated