X-NUCLEO NFC05A1 expansion board

Revision as of 07:05, 6 December 2019 by Registered User

1. Article Purpose[edit source]

The purpose of this article is to explain how to integrate the NFC05A1 expansion board with STM32MP157C-DK2, Software will run on Linux on Cortex®-A7. NFC05A1 board is a NFC card reader expansion board based on ST25R3911B for STM32 and STM8 Nucleos.

2. Prerequisites[edit source]

All the dependencies as per the LINK:Getting_started/STM32MP1_boards/STM32MP157C-DK2 should be installed

  • SDK must be installed and also enabled. [[1]]
  • Starter Package must be flashed onto SD-Card and board should boot up successfully.


2.1. Hardware Prerequisites[edit source]

  • STM32MP157C-DK2 Discovery Kit
  • X-NUCLEO-NFC05A1
  • 8 GB micro SD card to boot the STM32MP157C-DK2
  • SD card reader OR LAN connectivity
STM32MP157C-DK2

For more information about the STM32 discovery board and how to start it up, jump to this section Getting_started/STM32MP1_boards/STM32MP157C-DK2

  • NFC05A1 expansion board
File:X-nucleo-nfc05a1.jpg
X_NUCLEO-NFC05A1 board


2.2. Software prerequisites[edit source]

  • Linux PC with Ubuntu 16.04 LTS installed
  • The STM32MP157C-DK2 board must be downloaded with appropriate software in order to support NFC05A1 expansion board. For proceeding, follow the step-by-step instructions provided at STM32MP157C-DK2 Let's start.


3. Hardware setup - connections explained[edit source]

The X-NUCLEO-NFC005A1 is docked on to the Arduino connector present on the bottom side of the STM32MP157C-DK2 board as shown in below figure -

File:NFC05A1 and STM32MP157C-DK2 connection.png
Location of Arduino Connectors on both boards
NFC05A1
NFC05A1 docks over STM32MP157C-DK2


4. Software setup- Steps for quick evaluation of software[edit source]

In order to speed-up the development process and quickly evaluate the software, please follow below mentioned steps–

  • Please follow intsructions in the link : STM32MP157C-DK2 Let's start. to flash the Starter Package on the SD Card.
  • Boot the board with Starter Package.
  • Connect Ethernet LAN cable to CN8 of discovery kit. If LAN is not available, please see page 'How to transfer files using ‘Tera Term’: Windows PC to Discovery Kit '.
  • Connect a USB Keyboard to the discovery kit.
  • Open terminal and get the IP address of the board using below command on board
Board $> ifconfig | more
  • Download pre-built images and copy in aproriate locations - [[2]]
  • Download Developer Package and install the SDK in the default folder structure on your Ubuntu 16.04 machine.: Getting_started/STM32MP1_boards/STM32MP157C-DK2/Develop_on_Arm®_Cortex®-A7/Install_the_SDK
  • Update the device tree to enable the SPI4 driver interface. How to Enable SPI for Arduino shield interface.
  • Build the Developer Package as per instructions given in "README.HOW_TO.txt" file. To ensure that the device tree entry has been done successfully, you may check in the menuconfig if SPI interface is enabled. Please refer to instructions below -
  • “STMicroelectronics STM32 SPI controller” must be enabled. Snapshot below
File:SPI Enabled in Menuconfig.png
STM32SPI and SPIDEV will be compiled as part of the build


5. Cross-compile the Linux application code[edit source]

The application has been packaged using the GNU make utility. GNU CMAKE utility has been used to generate Makefiles and paths according to new directory locations. Please follow below steps to cross-compile (build) the Application.

  • Open new terminal on your Linux PC and set the environment to enable the SDK. Use below command (in case SDK is installed in default directory) :
 source /local/home/svshuk00/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi

Extract the RFAL_st25r3911_v2.0.10 package. Use below commands to extract and build -

 sudo apt-get install cmake
cd Linux_RFAL_st25r3911_v2.0.10/linux_demo/build
rm –rf *
cmake ..
make

The above commands would build below files –

  • The example application: Linux_RFAL_st25r3911_v2.0.10/linux_demo/build/nfc_poller/nfc_poller_st25r3911
  • shared lib for running the example application:Linux_RFAL_st25r3911_v2.0.10/linux_demo/build/rfal/st25r3911/librfal_st25r3911.so

6. RUN the application on STM32MP157C-DK2[edit source]

Copy the generated binaries onto the board

 scp Linux_RFAL_st25r3911_v2.0.10/linux_demo/build/nfc_poller/nfc_poller_st25r3911 root@<board ip address>:/usr/local/bin
 scp Linux_RFAL_st25r3911_v2.0.10/linux_demo/build/rfal/st25r3911/librfal_st25r3911.so root@<board ip address>:/usr/local/bin

Make ssh login to the DK2 board

 ssh root@<board ip address>

Export the shared lib to the environment

 export LD_LIBRARY_PATH=/usr/local/bin:$LD_LIBRARY_PATH 

Enter the directory where binaries were copied

 cd /usr/local/bin/ 

RUN the application

 ./nfc_poller_st25r3911

When the application starts running, below message is displayed on the screen. See snapshot below

“Welcome to the ST25R3911B NFC Poller Demo on Linux. 
Scanning for NFC Technologies ...........”

[ upload snapshot pic]
When a NFC tag is brought near the reader antenna, the communication takes place between the tag and reader and the UID is displayed on the screen. Snapshot below [ upload snapshot pic]