The onboard NFC chip uses ST25DV04KC semiconductor, as shown in the circuit diagram
NFC antenna connection diagram:
The following tests will be conducted under Debian 11 firmware version
To drive NFC, the first step is to refresh the Debian 10 firmware version, which was compiled starting from March 11, 20240402. If you have a firmware version of the development board that is newer than this, you do not need to upgrade it
Please refer to the burning system section for firmware flashing
Development board side control NFC corresponding source code and usage
The development board is developed under the Debian system using C/C++. Within the development board, the compilation environment is directly built, and the process is as follows:
$ sudo apt update
$ sudo apt install -y gcc
$ sudo apt install -y g++
$ sudo apt install -y aptitude
$ sudo aptitude install -y build-essential
Friendly reminder: After each of the above commands is executed, it is necessary to check the prompt information. If the software source is unstable, an error message of download failure will appear. Enter the command again and reinstall until there are no error messages
The source code compilation process is as follows
#Decompression source code
$ unzip R13588S-nfc-debian.zip
#Enter folder
$ cd R13588S-nfc-debian
#Compile source code
$ make
#Be sure to use sudo permissions to execute the program, and enter the password youyeetoo
$ sudo ./test_nfc
#The following are all runtime prompts
[NfcIOBasic.cpp:42->initAll] D NFC_LINUX:initAll() 0,i2c_no==6,gpo_pin=131,gpiochip=-1
[St25dv_Gpo.cpp:245->st25dv_GPO_Init_SysClass] D NFC_LINUX:Warning: interrupt pin seems already eported
[NfcIOBasic.cpp:44->initAll] D NFC_LINUX:initAll() 1 St25dv_Gpo_Init==0
[NfcIOBasic.cpp:48->initAll] D NFC_LINUX:initAll() 2 set_St25dv_Gpo_interrupt_init==0
[NfcIOBasic.cpp:52->initAll] D NFC_LINUX:initAll() 3 Open_I2C(6)==0
[NfcIOBasic.cpp:63->initAll] D NFC_LINUX:initAll() 4==0
[St25dv_Gpo.cpp:55->callback_st25dv_GPO_pthread_func_SysClass] D NFC_LINUX:start callback_st25dv_GPO_pthread_func_SysClass() poll_fd.fd=5
Get_IDs():Get_IC_REF() ret=0
Get_IDs():Get_UID() ret=0
getUid() ret=0
nfc Get_UID=B9 CE D4 15 67 50 02 E0
nfc IC=ST25DV04KC-XX
input key: 0)exit app 1)write tag youyeetoo.cn 2)write tag start android WeChat 3)Send FTM data 4)Set RF ON 5)Set RF OFF
According to the prompt, seeing nfc Get_UID=successfully obtained indicates that driving the NFC chip is successful,
Then follow the prompts and enter the following numbers to perform the test:
0)Exit the program
1)Label www.youyeetoo.cn
2)Write tags: Implement a mobile phone to swipe the development board antenna, and enable the mobile phone to self start the WeChat app
3)Send data from development board to mobile phone
4) Enable RF wireless channel
5) Turn off RF wireless channel
The FTM data transmission process and protocol between the development board and the mobile phone are as follows:
1 sender -->receiver sends inquiry packets
FE FE FE FE FLG1 00 00 00 14 L1 L2 L3 L4 FF FF FF FF 45 4E 44
Among them
FLG1: indicates the direction of data transmission, 02 development board ->mobile, 03: mobile ->development board
L1 L2 L3 L4: Indicates the total length of data to be sent (including all query packet lengths+business data length): The high bit of L1 length, L4 is the lowest bit of length, L2, L3, and so on
2 receiving end -->sending end responds to the response packet
FE FE FE FE 04 00 00 00 00 14 FLG2 00 00 00 00 FF FF FF FF 45 4E 44
among
FLG2: Indicates whether data acceptance is allowed E7 indicates acceptance, while E9 indicates busy refusal
The process of sending data from the sender:
Mobile NFC corresponding APP
The mobile app refers to the development library provided by STMicroelectronics for secondary packaging development
Clear log: Clear the previous part of the log
Send: Send data from the mobile end to the development board
Fill in data: Fill in the data to be sent
Clear data: Clear the data to be sent
The FTM data transmission process and protocol between the development board and the mobile phone are the same as the above development board
Due to the large amount of code, it will not be displayed here. Please download the source code for viewing and verification