ST UM2766 X-LINUX-NFC5 Package for Developing NFC/RFID Reader User Manual
- June 6, 2024
- ST
Table of Contents
ST UM2766 X-LINUX-NFC5 Package for Developing NFC/RFID Reader
Introduction
This STM32 MPU OpenSTLinux software expansion package demonstrates how you can
develop NFC/RF communication for a standard Linux system using our Radio
Frequency Abstraction Library (RFAL). The RFAL common interface driver ensures
that user function and application software is compatible with any ST25R
NFC/RFID reader IC.
The X-LINUX-NFC5 package ports the RFAL onto a Discovery Kit with STM32MP1
Series microprocessor running Linux to drive an ST25R3911B NFC front end on an
STM32 Nucleo expansion board. The package includes a sample application to
help you understand detection of different types of NFC tags and mobile phones
supporting P2P.
The source code is designed for portability across a wide range of processing
units running Linux and supports all lower layers and some higher layer
protocols of ST25R ICs to abstract RF communication.
Radio Frequency Abstraction Library for Linux
RFAL
| Protocols| ISO DEP| NFC DEP
---|---|---|---
Technologies| NFC-A| NFC-B| NFC-F| NFC-V| T1T|
ST25TB
HAL
| RF
RF Configurations
ST25R3911B
X-LINUX-NFC5 Overview
Main Features
The X-LINUX-NFC5 software expansion package includes the following features:
- Complete Linux user space driver (RF abstraction layer) to build NFC enabled applications using the ST25R3911B/ST25R391x NFC front ends with up to 1.4 W output power.
- Linux host communication with the ST25R3911B/ST25R391x via high speed SPI interface.
- Complete RF/NFC abstraction (RFAL) for all major technologies and higher layer protocols:
- NFC-A (ISO14443-A)
- NFC-B (ISO14443-B)
- NFC-F (FeliCa)
- NFC-V (ISO15693)
- P2P (ISO18092)
- ISO-DEP (ISO data exchange protocol, ISO14443-4)
- NFC-DEP (NFC data exchange protocol, ISO18092)
- Proprietary technologies (Kovio, B’, iClass, Calypso, etc.)
- Sample implementation available with X-NUCLEO-NFC05A1 expansion board plugged on an STM32MP157F-DK2
- Sample application to detect several NFC tags types
Package Architecture
The software package runs on the A7 core of the STM32MP1 series. The X-LINUX- NFC5 interacts with the lower layers libraries and SPI lines exposed by the Linux software framework.
X-LINUX-NFC5 Application Architecture in Linux Environment
Hardware Setup
Hardware requirements:
- Ubuntu-based PC/Virtual-machine version 16.04 or higher
- STM32MP157F-DK2 board (Discovery Kit)
- X-NUCLEO-NFC05A1
- 8 GB micro SD card to boot the STM32MP157F-DK2
- SD card reader / LAN connectivity
- USB Type-A to Type-micro B USB cable
- USB Type A to Type-C USB cable
- USB PD compliant 5V 3A power supply
The PC/Virtual-machine forms the cross-development platform to build the RFAL library and application code to detect and communicate with NFC devices through the ST25R3911B IC.
How to Connect The Hardware
Step 1. Plug the X-NUCLEO-NFC05A1 expansion board onto the Arduino connectors on the bottom side of the STM32MP157F-DK2 discovery board.
Nucleo board and Discovery board Arduino connectors
- X-NUCLEO-NFC05A1 expansion board
- STM32MP157F-DK2 discovery board
- Arduino connectors
Step 2. Connect the ST-LINK programmer/debugger embedded on the discovery board to your host PC via the USB micro B type port (CN11).
Step 3. Power the discovery board through the USB Type C port (CN6).
Full Hardware Connection Setup
RELATED LINKS
Refer to this wiki for more details related to power supply and communication
ports
Software Setup
Before you begin, power the STM32MP157F-DK2 Discovery kit via a USB PD
compliant 5 V, 3 A power supply and install the Starter Package according to
the instructions in the Getting Started wiki. You will need a minimum 2 GB
microSD Card to flash the bootable images.
To run the application, the platform configuration needs to be updated by
updating the device tree to enable the relevant peripherals. You can do this
quickly by using the pre-built images available, or you can develop the device
tree and build your own kernel images.
You can also (optionally) build this software package by including the Yocto
layer (meta-nfc5 ) in the ST distribution package. This operation creates the
source code and includes the device-tree modifications along with compiled
binaries in the final flashable images. For detailed steps describing the
process, see Section 3.5 .
You can connect to the Discovery Kit from the host PC via TCP/IP network using
ssh and scp commands, or through serial UART or USB links using tools like
minicom for Linux or Tera Term for Windows.
Steps for Quick Evaluation of Software
-
Step 01: Flash the Starter Package on the SD Card.
-
Step 02: Boot the board with Starter Package.
-
Step 03: Enable internet connectivity on the board via Ethernet or Wi-Fi. Refer to relevant wiki pages for help.
-
Step 04: Download pre-built images from the X-LINUX-NFC5 web page on the ST website
-
Step 05: Use the following commands to copy the device tree blob and update the new platform configuration:
If network connectivity is not available, you can transfer the files locally from your Windows PC to the Discovery Kit using Tera Term.
For further details on transferring data files using Tera Term.
-
Step 06: After the board boots up, copy the application binary and the shared lib to discovery board.
The application will start running once these commands are executed.
How to Update the Platform Configuration in The Developer Package
The following steps will allow you to set up the development environment.
-
Step 01: Download Developer Package and install the SDK in the default folder structure on your Ubuntu machine.
You can find the instructions here: Install SDK -
Step 02: Open the device tree file ‘stm32mp157f-dk2.dts’ in the Developer Package source code and add the code snippet below to the file:
This updates the device tree to enable and configure the SPI4 driver interface.
-
Step 03: Compile the Developer package to get the stm32mp157f-dk2.dtb file.
How to Build the RFAL Linux Application Code
Before you begin, the SDK must be downloaded, installed and enabled. Download the application from the link: X-LINUX-NFC5
-
Step 1. Run the commands below to cross-compile the code:
These commands will build following files:- The example application: nfc_poller_st25r3911
- shared lib for running the example application: librfal_st25r3911.so
How to Run the RFAL Linux Application on STM32MP157F-DK2
-
Step 01: Copy generated binaries onto the Discovery Kit using below commands
-
Step 02: Open terminal on the Discovery Kit board or use ssh login and run the application using the following commands.
The user will see the below message on the screen:
-
Step 03: When an NFC tag is brought near the NFC receiver, the UID and NFC tag type is displayed on the screen.
Discovery Kit Running The nfcPoller Application
How to Include Meta-nfc5 Layer in The Distribution Package
-
Step 01: Download and compile the Distribution Package on your Linux machine.
-
Step 02: Follow the default directory structure suggested by ST wiki page to follow this document synchronously.
-
Step 03: Download the X-LINUX-NFC5 application package:
-
Step 04: Set up the build configuration.
-
Step 05: Add the meta-nfc5 layer to the build configuration of the Distribution Package configuration.
-
Step 06: Update the configuration to add new components in your image.
-
Step 07: Build your layer separately and then build the complete Distribution Layer.
Note: Building the distribution page for the first time may take several hours. However, it takes only few minutes to build meta-nfc5 layer and install the executables in the final images. Once the build is complete, the images are present in the following directory: build-- /tmp-glibc/deploy/images/stm32mp1. -
Step 08: Follow instructions on ST wiki page: Flashing the built image to flash the new built images onto the
discovery kit. -
Step 09: Run the application as mentioned in Step 2 of Section 3.4.
How To Transfer Files Using Tera Term
You can use a Windows terminal emulator application like Tera Term to transfer files from your PC to the Discovery Kit.
-
Step 01: Supply USB power to the Discovery Kit.
-
Step 02: Connect the Discovery Kit to your PC via the USB micro B type connector (CN11).
-
Step 03: Check the Virtual COM port number in the device manager.
In the screenshot below, the COM port number is 14.
Screenshot of Device Manager Showing Virtual Com Port
-
Step 04: Open Tera Term on your PC and select the COM port identified in the previous step. The baud rate should be 115200 baud.
Snapshot of Remote Terminal via Tera Term
-
Step 05: To transfer a file from the host PC to Discovery Kit, select [File]>[Transfer]>[ZMODEM]>[Send] in top left corner of the Tera Term window.
Tera Term File Transfer Menu
-
Step 06: Select the file to be transferred in the file browser and select [Open].
File Browser Window for Sending Files
. -
Step 07: A progress bar will show the status of file transfer.
File Transfer Progress Bar
Revision History
Document Revision History
Date
|
Version
|
Changes
---|---|---
30-Oct-2020
|
1
|
Initial release.
1 5-Jul-2021
|
2
| Updated Section 1.1 Main features, Section 2 Hardware setup, Section 2.1 How to connect the hardware, Section 3 Software setup, Section 3.1 Steps for quick evaluation of software, Section 3.2 How to update the platform configuration in the developer package and Section 3.3 How to build the RFAL Linux application code.
Added Section 3.5 How to include meta-nfc5 layer in the Distribution Package. Added STM32MP157F-DK2 discovery kit compatibility information.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>