1.Hardware interface description:
The NFC chip ST25DV04K on the motherboard is controlled through the I2C4 of the CPU. The circuit diagram is as follows:
The use of onboard NFC function requires an external antenna, as shown in the wiring diagram
2.Download and install testing software
Download of testing software source code:
Linux-NFC Source File(Right Click->Save link as)
After downloading and testing the software decompression, there are two folders in it: Android and Linux,
The Linux folder contains the source code of NFC testing software, which needs to be compiled and run on the development board Linux
The Android folder contains supporting apps that need to be installed on NFC enabled phones
Android APP source code:
Android App Source Code(Right Click->Save link as)
3. Testing NFC functionality
3.1 Compiling Linux NFC source code
This source code uses the libgpiod library, which needs to be installed on the development board.
#Install the libgpiod library and header files
sudo apt -y install libgpiod-dev
Compile the test program source code and run the test program
#Compile NFC testing software source code
jb@X1:~/linux-spi/linux/$ make
#Run testing software
jb@X1:~/linux-spi/linux/$ sudo ./test_NFC
After testing NFC operation, input data through the keyboard to achieve different functions
#Run Test Program
jb@X1:~/linux-spi/linux/$ sudo ./test_NFC
#Write label: youyeetoo.cn
jb@X1:~/linux-spi/linux/$ 1
#Write tags: Android launches WeChat app
jb@X1:~/linux-spi/linux/$ 2
#Write data to FTM
jb@X1:~/linux-spi/linux/$ 3
#Exit program
jb@X1:~/linux-spi/linux/$ 0
Know the problem:
Experimental testing has found that after multiple restarts of Ubuntu, the device serial number corresponding to NFC I2C may change, sometimes it is/dev/i2c-4, and most of the time it is/dev/i2c-5 If the NFC link fails, you can switch to the I2C serial number, modification method, and modify it in the main function of the test file testNFC.cpp, as shown in the figure:
3.2 Test program NFC2023v1.1 for installing and downloading on Android phones_ 20230927_ Debug.apk
Taking Android phones as an example, the phone needs to support NFC function and enable it,
As shown in the figure: Testing NFC using Android APP, after opening the software, the phone needs to be close to the NFC antenna board for testing
The upper part: mainly consists of logs,
The next part: The mobile phone transmits data to the X1 SBC development version through NFC
3. NFC test program Qt interface
Please refer to the following page for sample source code and how to compile and use the QT interface of the testing program:
https://wiki.youyeetoo.com/en/x1/linux/qt-build