The NFC module was designed using Broadcom BCM20793 chip, hardware design was performed, and device driver analysis was performed. The module has been verified in many aspects, and the results show that the module is stable, reliable, has a high recognition rate, and can be integrated into payment, ticketing, access control, anti-counterfeiting and other systems.
introduction
NFC (Near Field Communication) is a new short-range wireless communication technology jointly launched by Philips and Sony. NFC is developed from radio frequency identification (RFID) and mobile terminal technology. It combines the functions of inductive card reader, inductive card and point-to-point on a single chip, and can identify and exchange data with compatible devices within a short distance. . The NFC operating frequency is 13.56 MHz. It uses electromagnetic induction coupling for data transmission. It has two-way connection and identification characteristics, is compatible with identification technologies of different standards, has a communication distance of less than 4 cm, and supports multiple communication rates. Due to limitations in transmission rate and communication distance, NFC is not suitable for the transmission of big data, and the communicating parties must have a certain degree of mutual trust.
The emergence of NFC technology has changed the way people use certain electronic devices, and even changed the way they use credit cards, cash and keys. It can be applied to portable devices such as mobile phones to achieve secure mobile payments and transactions, and simple end-to-end transactions. terminal communication, easy access on the move and other functions. With the rapid rise of smartphones, the combination of NFC and smartphones will greatly promote the development of NFC. The iPhone 6 launched by Apple also has NFC functions. I believe that NFC will be widely used in the near future.
This article uses the Broadcom BCM20793 NFC chip and combines it with the S3C6410 main controller to design an NFC reader with active mode and passive mode, mainly focusing on the hardware and driver design.
1 Principles of NFC technology
NFC has three working states: Reader/Writer is related to NFC Tag/NFC Reader; Peer-to-Peer supports two. NFC device interaction; Card Emulation can simulate NFC-enabled devices into SmartCards. These three working states can be divided into passive mode and active mode. They are in passive mode in Reader/Writer and Card Emulation states, and in active mode in Peer-to-Peer state.
In passive mode, the master device is responsible for initiating communication and at the same time generating electromagnetic induction through the RF coil to provide power to the slave device. In this mode, the transmission rate can be selected as 106 kbps, 212 kbps or 424 kbps, using load modulation (load modulation) method to send data to the slave device. The slave device may not contain power components and use the same rate in load modulation mode. Return the data to the main device, and the entire communication process is shown in Figure 1.
This communication mechanism is compatible with contactless smart cards based on ISO14443A, MIFARE and FeliCa. The main difference lies in the RF layer signal modulation and demodulation method, transmission rate and encoding method. Therefore, an NFC initiating device in passive mode can detect and establish contact with a contactless smart card or NFC target device using the same connection and initialization process.
In active mode, when devices communicate with each other, both the initiating device and the target device must generate their own radio frequency fields to communicate. In this mode, NFC uses two-way identification and linking. There is no fixed master-slave relationship between communication parties, and communication can be initiated by any NFC device. This is the standard mode of peer-to-peer network communication and allows for very fast responses. The communication process is shown in Figure 2.
In addition, the fast and lightweight NFC protocol guides the Bluetooth pairing process between two devices. Compared with other wireless communication technologies, NFC is a short-distance private communication method that provides easy, secure, fast and automatic communication between various devices. For RFID, it has the characteristics of short distance, high bandwidth, low power consumption, etc.; it is faster, more stable and simple than infrared; compared with Bluetooth, NFC communication distance is short and suitable for exchanging important data.
2 Hardware design
The NFC module is mainly composed of three parts: NFC (controller, which can interact with the Device Host or Secure Element security unit), Antenna (antenna) and Contactless Front-End (contactless front-end, responsible for the modulation and demodulation of radio frequency signals). This design uses the BCM20793 chip, which supports data transmission rates of 212 or 424 kbps and is specially designed for low-power, low-price equipment. The module provides PCI, I2C bus, and UART serial interfaces. The security unit can be connected to SD cards, SIM cards, SAM cards or other chips, and is compatible with multiple communication standards. The chip also supports multiple working modes such as low power consumption mode, normal working mode, polling mode, etc.
The main controller uses the S3C6410 chip, which has high performance, low power consumption, high cost performance, and can run the Android system. BCM20793 and S3C6410 adopt the I2C bus connection method. The TX1 and TX2 pins are connected to the RC matching circuit, and P_JS_IT_18 of the RC matching circuit is connected to the antenna. The NFC chip is powered by a voltage of 1.8 V. It is connected to the main controller by 6 pins, namely NFC_I2C_SD data line, NFC_I2C_SCL clock line, NFC_I2C_REQ interrupt, NFC_REQ_PU enable, HOST_WAKE wake-up, NFC_CLK_REQ clock enable, and the I2C physical communication address is 0x77, the clock signal is provided by a 19.2 MHz external crystal oscillator. The NFC circuit schematic is shown in Figure 3.
3 NFC driver analysis
3. 1 Device tree analysis
The kernel of this design uses Linux version 3.4. Different from previous kernel versions, kernel version 3.4 uses a device tree to uniformly manage driver devices to facilitate device management. NFC uses the I2C bus connection method to connect to the CPU. The driver is only responsible for sending and receiving data, and the upper layer is responsible for data analysis.
The following is the device tree node configuration information of BCM2079x, including: the communication address of the I2C bus is 0x77, the interrupt is No. 34, GPIO34 is the interrupt pin, GPIO65 is the enable pin, and GPIO20 is the wake-up pin. The most critical one is the compatible="broadcom, bcm2079x_i2c" key-value pair. When loading the driver, this field will be matched first. If they are equal, the probe function will be called to perform related initialization work.
The following is the I2C bus configuration information. GPIO31 is used as the clock signal line of the I2C bus, GPIO32 is used as the data signal line of the I2C bus, and the clock frequency of the I2C bus is 19.2MHz.
The bcm2079x_matcn_table structure in the driver is responsible for matching with the device tree. During the system initialization phase, it will match whether the .compatible attribute in the device tree has the same name in the driver. In this driver, it is broadcom, bcm2079x_i2c. If the match is successful, The driver's probe function will be called to perform initialization work.
In the driver, bcm2079x_parse_dt is responsible for parsing the code of the device tree. The following is the key code of device tree parsing to obtain interrupt, enable and wake-up pins respectively.
3.2 Driver initialization analysis
When the kernel loads the driver module, the system will call the bcm2079x_dev_init() function, which has i2c_add_driver() nested inside to complete the registration of the bcm2079x_driver structure. The system will automatically detect the driver device and compare whether there is a compatible one in the device tree. = "broadcom, bcm2079x_i2c" key-value pair to determine whether the device exists. If it exists, I2C device related information will be registered, i2c-client will be created, the probe function will be executed, and the pins configured in the device tree will be parsed in the probe function, interrupts will be initialized, memory space will be allocated, mutexes will be initialized, waiting queues will be initialized, etc. And register the driver as a misc driver with the system, and then register the interrupt with the system. The flow chart is shown in Figure 4.
3.3 Driver operation mechanism
When the user space calls open to open the /dev/bcm2079x device node, the ioctl of the driver is called through the ioctl mechanism to enable and wake up the device; then the Poll function is called to implement periodic detection to reduce the power consumption of the device. When a device or card approaches an NFC device, NFC will generate an interrupt to wake up the device, and the user space can read I2C data by calling the read function. The operating mechanism is shown in Figure 5.
4 test results
The NFC device is usually in a sleep state, and the device will also send out detection pulses. At this time, it is in a low power consumption state. When a card or NFC device approaches the NFC device, an interrupt will be generated to wake up the device, and the NFC device will continuously send out detection pulses. At this time, NFC is working in normal working mode.
Figure 6 is the detection pulse signal observed with a spectrum analyzer. The carrier frequency is 13.559 375 000 MHz and the occupied bandwidth OBW is 2.259615 385 kHz, which meets the 13 553~13 567 MHz radio frequency test requirements for the NFC band in CE and FCC certification. modulation bandwidth limit.
When the Tag1 small card is placed close to the NFC antenna, the binary information in the card can be read. Figure 7 shows the information in the card.
Previous article:Ethercat implementation based on S3C2440
Next article:Design of wireless real-time image transmission system based on S3C2440A
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [NXP Rapid IoT Review] Study various documents
- cc2640 data processing problem
- Summary of Common/Uncommon IOT Protocols
- There are many "tools" that are not fully understood.
- Some people started preparing for the national competition in junior high school! What would happen if we started learning electronics in junior high school?
- Principles and methods for selecting voltage zener diodes
- Types of MOS tubes in Wien bridge
- Automatic charging of power banks is annoying!
- Please tell me the decompression password for the downloaded data!
- Due to the company's production needs, we need to purchase STM32F437VIT6 chips