NFC: TNEP poller

The NFC TNEP poller sample demonstrates how to use the TNEP for polling device library to exchange data using an NFC polling device.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nRF52 DK

PCA10040

nrf52dk

nrf52dk/nrf52832

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

The sample has the following additional requirements:

  • NFC Reader ST25R3911B Nucleo expansion board (X-NUCLEO-NFC05A1)

  • NFC Type 4 Tag TNEP device

Overview

The sample interacts with the NFC Type 4 Tag.

The sample reads the NFC Type 4 Tag and looks for the TNEP initial message. After finding it, the first service from the message is selected and the poller attempts to exchange data. Next, the service is deselected.

Building and running

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

To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

Note

If you are using debug messages in the NFCT driver, the driver might not be working properly if you have CONFIG_LOG_MODE_IMMEDIATE enabled. The NFCT driver is part of the nrfx driver package. For more information about this driver, see the NFCT driver page in the nrfx repository.

Testing

After programming the sample to your development kit, you can test it with an NFC-A Tag device that supports NFC’s TNEP. Complete the following steps:

  1. Connect to the kit with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  2. Reset the kit.

  3. Put the NFC Tag device antenna in the range of the NFC polling device. The NFC polling device selects the first service and exchanges basic data with it. After that, the service is deselected.

  4. Observe the output in the terminal.

Dependencies

This sample uses the following nRF Connect SDK drivers:

It uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries:

  • include/zephyr/types.h

  • include/sys/printk.h

  • include/sys/byteorder.h

  • include/zephyr.h