NFC: TNEP Tag¶
The TNEP Tag sample demonstrates how to use the Tag NDEF Exchange Protocol for NFC Tag Device library to exchange data using NFC’s TNEP Protocol on an NFC Tag Device.
The sample uses the Type 4 Tag as the Tag transport layer. Initially, the sample creates the Initial NDEF message that contains the Services Parameter records and the NDEF records.
The NFC Poller device that does not support the TNEP library can interact with the NDEF records. If the Poller does supports the TNEP library, it can select the TNEP Service and exchange data with it.
Every TNEP Tag service has a callback structure that provides information to the application about Service State changes. The sample has two TNEP services defined, each of them containing the NDEF text records.
One of the following boards:
nRF5340 PDK board (PCA10095) - see Working with nRF5340
nRF52840 DK board (PCA10056)
nRF52 DK board (PCA10040)
- LED 1:
On when the TNEP Tag is initialized.
- LED 3:
On when the TNEP service one is selected.
- LED 4:
On when the TNEP service two is selected.
- Button 1:
Press to provide the application data when the application service two is selected.
Building and running¶
This sample can be found under
samples/nfc/tnep_tag in the nRF Connect SDK folder structure.
See Building and programming a sample application for information about how to build and program the application.
After programming the sample to your board, you can test it with an NFC-A Poller device that supports NFC’s Tag NDEF Exchange Protocol.
Connect to the board with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Reset the board.
Touch the board antenna with the NFC Poller device.
Observe the output in the terminal.
If the NFC Poller device selects the service two, you have 27 seconds to press the Button 1 to provide application data. If you do not do this, the NFC Poller device will deselect the service.