X-NUCLEO NFC05A1 expansion board

Revision as of 09:18, 23 October 2019 by Registered User (→‎Software setup- configuration steps)

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

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- configuration steps[edit source]

Please follow below steps to first flash the Starter Package onto the SD Card and then customize the platform to run application for X_NUCLEO NFC05A1. Please follow intsructions in the link : STM32MP157C-DK2 Let's start. to flash the Starter Package on the SD Card. In order to set up the development platform, please follow below mentioned steps –


  • Download pre-built images and copy in aproriate locations - [[1]]
  • Build the Developer Package as per instructions given in "README.HOW_TO.txt" file. To ensure that the patch has been applied successfully, you may check in the menuconfig if SPI and gpio interfaces are 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
  • “/sys/class/gpio/… (sysfs interface)” must be enabled. Snapshot below
File:Sysfs-gpioEnabledinmenuconfig.jpg
sysfs interface for GPIO access is enabled


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

{{PC$ 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]