NFC: Tag reader
The NFC Tag reader sample demonstrates how to use the NFC Reader ST25R3911B driver to interact with an NFC-A Tag.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Board target |
---|---|---|---|
PCA10095 |
|
||
PCA10040 |
|
||
PCA10056 |
|
The sample has the following additional requirements:
NFC Reader ST25R3911B Nucleo expansion board (X-NUCLEO-NFC05A1)
NFC Type 2 Tag or Type 4 Tag
Overview
The sample shows how to use the ST25R3911B NFC reader to read data from a tag that supports the ISO/IEC 14443 standard (NFC-A technology). You can use this device to read and parse content of an NFC Type 2 Tag or Type 4 Tag.
After successful parsing, the tag content is printed using the logging subsystem.
Before reading data, the sample sends the appropriate initialization commands (ALL Request, SENS Request) to detect which NFC technology is used. It also performs an automatic collision resolution.
Supported tag types are:
NFC Type 2 Tag
NFC Type 4 Tag
Building and running
This sample can be found under samples/nfc/tag_reader
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 Type 2 Tag or Tag 4 Type. Complete the following steps:
Connect the Nucleo expansion board to the development kit.
Connect to the kit with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.
Reset the kit.
Touch the ST25R3911B NFC reader with a Type 2 Tag or Type 4 Tag.
Observe the output in the terminal. The content of the tag is printed there.
After a short delay, the tag can be read again.
Dependencies
This sample uses the following nRF Connect SDK drivers:
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
include/zephyr/types.h
include/sys/printk.h