With the development of science and technology in modern society, people have higher and higher requirements for the portability, convenience and efficiency of mobile products. As a special type of smart card, SIM card adopts standard contact IC card and complies with IS07816 standard specification. It follows the characteristics of smart card in security and plays a very important role in mobile commerce. Therefore, the application scope of SIM card is becoming wider and wider, and it can be applied to high-end application fields such as finance and convenient payment. However, for the cards that have been put on the market, it is difficult for operators to identify which supplier supplies the products, and it is also necessary for suppliers to conduct quality inspection on the cards they produce. In view of the high cost performance of ARM, this paper adopts a CPU STR711FR2 based on ARM7TDMI core as the processor as the system core, and designs a SIM card reading system, which can be compatible with A, B, C cards that comply with 7816 protocol, and is used to read the information solidified inside the chip, so as to confirm the manufacturer of the chip and implement quality inspection on the chip.
1 System Structure
The card reading system is mainly composed of a card reading module, a serial communication module, a USB communication module, a JTAC download and debug module, and corresponding clock and reset circuit modules and upper-level software. The main control circuit is composed of ST's STR711FR2 and its peripheral circuits, which mainly realizes the sending of commands and the transmission and processing of received data. The system adopts a contact working mode. The chip is inserted into the interface slot, and the main control chip sends instructions to complete the reading of card data. The obtained data is then transmitted to the PC through the serial communication module. The received data is processed and judged by the upper-level software, and the results are displayed on the PC. The system structure is shown in Figure 1.
2 Hardware Platform Design
2.1 Platform Architecture
STR711FR2 is a high-performance, low-cost, low-power microcontroller based on the ARM7TDMI core from ST. It has built-in 256+16 k Flash and 64 k RAM, and has rich peripherals: such as smart card ISO-7816-3 interface, USB 2.0 interface, UART interface and rich IO interface.
In this system, STR711FR2 is used as the main processor, and the USB interface is used to power the system and as a backup data channel; the JTAG interface is used to debug the system and download firmware; the 78 16 smart card interface is used as a card insertion port; the serial port is used to transmit the read data. The system is powered by the USB interface; the STR711FR2 is clocked by an external 4 M crystal oscillator, and the 32.768 k crystal oscillator is used as an auxiliary clock and provided to the internal real-time clock. STR711FR2 and LTC1955 send different commands through the serial port to determine the type of card inserted, so as to generate the corresponding voltage of the card, and then send a command to read the data, and then transmit the data to the PC for display through the serial communication module. The hardware platform architecture is shown in Figure 2.
2.2 Power supply part
The power supply voltage of the USB interface part is 5 V, and the maximum current can reach 500 mA. The MCU and Reader in the system are two major energy-consuming components. The full-load working current of STR711FR2 is 200mA, and the full-load working current of LTC1955 does not exceed 100 mA. The rated voltage of LTC1955 and STR711FR2 is 3.3 V, so it is necessary to convert 5 V into 3.3 V voltage. The conversion chip uses ASM1117S33. After the conversion, the system can be powered by USB. In addition, STR711FR2 supports USB2.0 transmission protocol, so the differential line of USB can be weakly supported with a 1.5kΩ resistor and connected to the 42nd and 43rd pins of the main MCU respectively. In order to support the high-speed transmission mode of USB, this part can also be used as a backup data transmission channel. The circuit is shown in Figure 3. [page]
2.3 7816 interface part
The pin definition of SIM card complies with ISO7816 integrated circuit card with electric shock specification. It is actually a chip card equipped with a microprocessor, including 5 modules and a machine-card separation interface. The communication is safe, reliable and low-cost. Among them, C1 pin is power supply VCC, C2 pin is reset RST, C3 pin is clock CLK, C4 pin is not connected, C5 pin is ground GND, C6 pin programming voltage VPP, C7 pin is data I/O port, and C8 pin is not connected. In addition to C4 and C8 pins, which have been expanded by the International Standards Organization to become a new generation of high-speed SIM card interface, C6 high-voltage programming pin has lost its function because SIM card can realize the EEPROM erase and write function internally without external VPP signal.
The 7816 interface part uses Linear's dedicated chip LTC1955. LTC1955 supports ISO7816-3 protocol, has good power management and control capabilities, and has a serial data interface, through which data control and status control can be performed, and can automatically power off when electrical errors occur. The built-in voltage collapse can generate 1.8 V, 3 V and 5 V voltages, so it is compatible with 7816 A, B, C3 cards. The card interface can automatically detect the card type through the detection channel generated by the automatic oscillation circuit. The serial port sends commands based on the detected information to select the card type. Different command status bits can select different types of cards. This system design only uses one B card slot. The 32nd and 31st pins of the chip are synchronous and asynchronous pins, respectively, and are connected to the P1.8 and P1.9 pins of the main control chip. The synchronous and asynchronous commands are sent through the central control IO to select the transmission mode. The data pin DATA is connected to the P1.15 pin of the main control chip to transmit the received data. The RIN reset pin information is sent through the P1.14 control of the main control chip. The circuit design is shown in Figure 4.
2.4 UART part
The communication interface is the channel and bridge for the system to exchange information with the outside world. Therefore, the design of the communication interface is indispensable in the system. Through the comparison of the current mainstream communication methods, this system adopts the UART method. The key to the UART circuit is to achieve the matching of STR711FR2 and PC level. The PC level is 12 V and the level of STR711FR2 is 3.3 V, which requires level conversion. There are many such level conversion chips, such as MAX3232 and ST3232, etc. This system uses MAX3232 chip for conversion. MAX3232 can not only meet the needs of the host, but also has a single 3.3 V power supply, which can realize the sending conversion and receiving conversion functions at the same time. The chip provides 2 UART channels, which can connect 2 RS3232. This system only uses one UART, and only the first channel needs to be selected, and the other one is not connected. Its circuit design is shown in Figure 5.
3 Implementation of software detection system
SIM card complies with the international standard 7816 protocol specification, so this detection system is divided into two parts, the first part is the firmware part for 7816 protocol communication, and the second part is the upper software part. The operation of the firmware part should include three processes: interface device activation circuit, cold reset to start card response, card and interface device to exchange information, and interface device release circuit card power off. [page]
After the card and interface device are physically connected, in order to start the mechanical connection of the card interoperability, the interface device needs to activate the card. Initially, all ports are in low level (L) state, with a voltage range of 0 to 0.4 V; VCC power supply voltage is powered on first (H state), and after the VCC power supply end is stable for a period of time, the IO port is set to receive mode (H state), the circuit activation sequence ends, and the card enters the reset process. At Ta time, CLK starts to provide clock signal; the card should set the IO port state to receive state within at least 200 clock cycles after the clock signal starts (delay time is Ta). At the same time, starting from Ta, RST maintains the L state for at least 400 clock cycles (delay time is Tb), that is, RST is set to H state after time Tb. In order to ensure the normal reset of the card, the card must respond within 400 to 40,000 clock cycles (delay time is Tc), that is, return ATR from the IO port. The reset process ends. The timing is shown in Figure 6.
After power-on, the interface device can select the working mode according to the ATR returned by the card. If TA2 is specified in the ATR, the interface device starts the information exchange mode with the card according to the new parameters; if TA2 is not specified in the ATR, the interface device and the card can perform the PPS process or the interface device can select which communication protocol to use according to the parameter (T) in TD1. If the interface device stops exchanging data with the card and the IO port remains in the H state for at least 1 860 (Tg) clocks, the interface device can stop the clock at Te, at which time VCC remains powered and RST remains at a high level. The clock stop timing is shown in Figure 7.
After the information exchange is completed, the card is released, RST is set to state L: CLK is set to state L (unless the clock has stopped at state L) IO is set to state L: VCC is released.
The upper-layer software is designed in C++. Since the card is just shipped and has not yet been delivered to the operator for use, the ATR is sometimes written with the manufacturer's relevant information. The chip can be detected based on this information, but once it is put on the market by the operator, the operator's cos will be downloaded. At this time, ATR also becomes the operator's, so it cannot be detected based on ATR. However, when the card leaves the factory, the card manufacturer will download its own cos to the NVR, which contains the card manufacturer's logo information, such as the card's business code, production time, lot number, and coordinates. Once these contents are downloaded, they cannot be modified, so they can be detected based on this. The detection process is shown in Figure 8.
4 Conclusion
This paper presents a SIM card detection system based on the ARM7 core. Through testing, the detection function can be successfully realized. This system adopts a standard contact card design and is compatible with 7816 A, B, and C cards, providing a feasible platform for contact and later upgraded contactless card reading information.
Previous article:Simple digital photo frame based on ARM9
Next article:Application of Standard Peripheral Library of STM32F10X Series Microcontrollers
Recommended ReadingLatest update time:2024-11-16 16:47
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to read and decode the PPM signal of the RC remote control
- 【TouchGFX Design】graph waveform drawing
- C5000 compiles SUBC instruction to implement division
- [Project source code] Verilog language routine "Wang Jinming: "Verilog HDL Programming Tutorial""
- Recommend a micropython development software thonny
- Understanding design engineers from a system perspective
- [SC8905 EVM Evaluation] +Discharge Output Voltage Regulation
- Recruiting energy storage hardware engineers
- Please analyze the diode in this circuit.
- National Chip 1 at TaoTaoMu Exhibition: Qinheng Beauty Chapter "Bluetooth 5.1 Chip & RISC-V Series MCU"