nRF5 SDK for Thread v0.11.0
Thread NFC MeshCoP Example

The Thread NFC MeshCoP example demonstrates Thread native commissioning through NFC with the use of OpenThread and Border Router. It uses the on-chip NFC tag that is present on nRF52840 to initiate a commissioning procedure.

This example implements the CLI interface, so more advanced users can communicate with the node through a serial port and configure it manually. For more information, refer to Thread CLI Example.

Description

For proper operation, this example must be used along with Nordic's Border Router with the EXPLORE-NFC-WW Raspberry Pi shield.

The image below presents the hardware components used in this example (from the left):

br_rpi_nfc_shield.png
Hardware used in this example

After the border router is booted together with the NFC shield, you can run commissioning. If the device was previously commissioned, you can perform a factory reset to remove any network information. To start the commissioning process, bring the NFC antenna of the device close to the NFC antenna of the border router. You can determine progress of the commissioning with BSP_LED_0 and BSP_LED_1.

Commissioning process

On startup, the node will try to automatically connect to the last known network. If it succeeds, the device enters commissioned state. Otherwise, it switches to not commissioned state. In not commissioned state, NFC is enabled as Type 2 Tag with NDEF message containing the commissioning data. After NFC field detection (device is read by the border router NFC shield), the node switches to commissioning state in which it tries to join the network with maximum three attempts. If it succeeds, the device starts network attachment and enters commissioned state. Otherwise, it falls back to not commissioned state waiting for another NFC read.

LED assignments

Button assignments

Network and commissioning states

Network state LED indication
Not connected Low frequency blink - 200 ms on, 800 ms off
Attaching High frequency blink - 100 ms on, 100 ms off
Connected Solid
Commissioning state LED indication
Not commissioned Low frequency blink - 200 ms on, 800 ms off
Commissioning High frequency blink - 100 ms on, 100 ms off
Commissioned Solid

Setup

You can find the source code and project files in the following folder: <InstallFolder>\examples\thread\experimental\nfc_meshcop.

Testing

To test this example, you need the nRF52840 Development Kit and Nordic's Border Router with the EXPLORE-NFC-WW Raspberry Pi shield.

  1. Build the example according to the instructions in Building examples.
  2. Program the development kit with the Thread MeshCoP example.
  3. Connect to the board through UART. The application uses the following UART settings:
    • Baud rate: 115.200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: None
  4. Bring the NFC antenna of the development kit close to the NFC antenna of the border router.
  5. Wait until the device is connected to the network (BSP_LED_0 indicates connected state and BSP_LED_1 indicates commissioned state).
  6. Ping Google DNS server from the development kit:
    >ping fd00:0064:0123:4567::0808:0808

Documentation feedback | Developer Zone | Subscribe | Updated