Abstract: μPSD32xx is a SoC microcontroller integrating 51 cores and PSD (Programmable System Device). It has many functional components and is cost-effective. It is widely used in tax control equipment such as tax control cash registers, tax controllers and micro printers. middle. This article introduces the main features and development environment of μPSD32xx microcontroller, and provides a software and hardware design plan for using this chip to implement a tax controller. Keywords: μPSD3234A; tax controller; modular design; API function 1 Introduction Tax control equipment is one of the inevitable means for the national taxation department to realize the informatization of tax management. As one of the tax control equipment, the tax controller is an important component in computers and other electronics It is an electronic device that realizes tax control functions with the cooperation of equipment. It can ensure the correct generation, reliable storage and safe transmission of business data, and can meet the management and data verification requirements of tax authorities. The tax controller is usually connected to an ordinary cash register (host) to jointly complete the functions of operation and tax control. The connection relationship is shown in Figure 1. The tax controller is an embedded system integrating software and hardware. In order to use the microcontroller more effectively and improve the versatility of development, platform thinking and modular design can be adopted to divide the hierarchical structure to achieve as much flexibility as possible in hardware and software. of portability. 2 Introduction to μPSD32xx microcontroller 2.1 Main features The μPSD32xx series is a new type of microcontroller launched by ST (STMicroelectronics). It uses an enhanced MCS-51 core and is an MCU+PSD SoC microcontroller. The device has the following characteristics: ● 2 pieces Flash memory , used to store programs or data, and easy to implement in-application programming (IAP) functions. ●Large-capacity SRAM with backup power protection can be selected. ●Two types of programmable logic circuits, namely address decoding DPLD and combinational logic CPLD. ●Six groups of general-purpose I/O provide up to 37 or 46 I/O pins. ●Master-slave mode I2C. ●USB 1.1 in low speed mode. ●2 serial channels UART. ●JTAG port for system programming.
2.2 Development environment system software can be designed, compiled and simulated in KEIL's KEIL 51 integrated development environment μVision2, and ST's PSDsoft Express can be used. s software for programming download and internal configuration. This software can configure the on-chip Flash, SRAM and PLD of μPSD32xx series microcontrollers, and integrate the compiled program code files (.HEX) and configuration files to generate. The OBJ file is downloaded to the microcontroller. When downloading, you also need to use a FlashLINK programming cable to connect the standard parallel port of the PC and the JTAG port of the microcontroller. 3 Hardware design plan 3.1 Hardware requirements The basic functions that the tax controller should have are as follows: a real-time clock and a large-capacity memory for recording tax control data; an IC card reader and writer that complies with the ISO7816 standard, and supports tax control cards, user card and tax management card; can communicate with the host through USB or serial port; has a backup battery that can save memory data and clock operation after power failure; allows abnormal power outage without destroying any valid data. 3.2 Hardware system composition The hardware system structure inside the tax controller is shown in Figure 2. (1) Main control module MCU The main control module MCU adopts ST's μPSD3234A microcontroller, which has a 256kB main Flash and a 32kB secondary Flash. h and 8kB SRAM, the operating voltage is 5V, and a 24MHz crystal oscillator is selected. The SRAM is powered by an off-chip backup battery, which can store some long-term data and requires only 1μA to maintain the current. The main control module is connected to the host through USB or UART, connected to RTC through I2C, and connected to ICC and MEM through I/O. (2) Clock module RTC The clock module RTC uses ST's M41T0M6. This chip has a real-time clock/calendar function and can time milliseconds, seconds, minutes, hours, days of the week, days, months, years, and centuries. After the system is powered off, it can be powered by an off-chip backup battery to keep the on-chip clock running. Using a 32.768kHz crystal oscillator, the operating voltage is 5V, the operating current is 130~200μA, the backup battery voltage is 3V, and the maintenance current is only 1uA. The maximum transmission rate of I2C is 400kHz. (3) Memory MEM The memory MEM uses ST's 2MB serial Flash chip M25P16. It has a total of 32 sectors, each sector has 256 pages, each page has 256 bytes, and the page programming time is 1.4m. s. M25P16 adopts SPI bus interface, with a maximum transmission rate of 50MHz and a low operating voltage of 3.3V. In order to achieve 5V-3.3V logic level conversion, Onsemi's three-way non-inverting Schmitt trigger NL37WZ17 can be used. It is compatible with 5V and 3V logic levels, and the output drive can reach 24mA. Flash memory is mainly used to store invoice data and tax control data. (4) IC card module ICC The IC card module ICC adopts Onsemi's NCN6004A. NCN6004A has a dual-channel card interface and complies with ISO 7816-3 and EMV standards. Working voltage 5V, current 150mA, built-in DC/DC, can provide 65mA/5V power supply for each card, external crystal oscillator 14.28MHz, built-in programmable card communication bus clock. The MCU communicates serially with the NCN6004A through the I/O line. In order to save I/O resources, you can choose the multiplexing connection method, that is, two cards share one channel and are distinguished by the card selection signal to realize the access functions of the tax control card and the user card respectively. (5) USB interface MCU has a USB communication controller inside. For filtering and ESD protection, the interface part uses Onsemi's STF202. The working voltage of STF202 is 3.3V, and the DIN2 pin has an internal 1.5kΩ pull-up resistor. Since the MCU only supports low-speed USB devices, its USB_D_ must be connected to the DIN2 of the STF202, with a communication rate of 1.5Mb/s. (6) UART interface UART conversion chip adopts Intersil's HIN202. There are 2 UARTs inside the MCU, both of which can use RS232 communication. The working voltage of HIN202 is 5V and has 2 transceiver drivers. (7) Power module PWR The external power supply of the system is divided into two routes. One route uses an AC/DC adapter to directly provide +5V; the other route is input by the host through a USB interface line (5V/500mA). Users can choose any channel to directly provide 5V device work. In order to realize the electrical protection function, Onsemi's boost chip NCP1402SN50T1 is used. Its minimum input starting voltage is 0.8V, the output voltage is 5V, and the output current is 200mA. When the system is working normally, NCP1402SN50T1 can charge the large capacitor. Once the power is cut off, the large capacitor can still keep the chip working for a period of time. At this time, some important tasks can be completed to avoid errors caused by abnormal power outage. The large capacitor uses two 3.3F/2.5V winding capacitors connected in series, which can maintain power supply for more than 30 seconds when fully charged. The 5V to 3.3V voltage converter uses Onsemi's NCP500SN33T1. The output current of this chip is 150mA and can provide operating voltage for 3.3V devices. The backup battery uses two 3V/210mAh lithium batteries, which can provide power for at least 10 years. (8) Monitoring module MON The monitoring module uses Onsemi's MAX708. MAX708 can achieve power-on reset and manual reset, and also has a voltage monitoring function. During design, an appropriate voltage dividing resistor is connected to its PFI end, so that when the main power supply is powered off, MAX708 can generate a power-down interrupt signal to complete important tasks or back up important data. The MAX708 operating voltage is 5V, the reset threshold is 4.38V, the reset time is 200ms, and the low-voltage monitoring input threshold is 1.25V.
(9) Status indication SIC The status indication uses light-emitting diodes, which are used to indicate the status of power on, card insertion, JATG program downloading, etc. Status indications such as error, operation, and self-test can also be connected to the I/O of the MCU. 4 Practical application circuit The connection circuit diagram between the MCU and other core hardware in the tax controller is shown in Figure 3. The figure shows how the clock, Flash memory and IC card modules are connected to the MCU. 5. Software design plan The tax controller software generally consists of two parts: host-side software and device-side software. The data communication between the host side and the device side adopts the "command-response" method. The host sends the command and the device responds. The host-side software can be divided into four layers: application layer, tax control function layer, communication management layer and device driver layer; the device-side software can also be divided into four layers: main control layer, tax control function layer, device management layer, and hardware driver layer. The following mainly introduces the device-side software architecture. 5.1 Main control layer The main control function is responsible for the initialization of the system and equipment, communication monitoring with the host, protocol management, interpretation of tax control command packages, and task scheduling. 5.2 Tax control function layer The tax control function is designed in accordance with the national standard requirements for tax controllers and is responsible for machine initialization and registration, invoice distribution, invoicing, refunding, invalidating invoices, uploading invoices, daily transaction and volume summary data, declaration, and verification etc. affairs. 5.3 Equipment management layer The equipment management layer is a management program designed for complex equipment, mainly including IC card management, memory management, and USB communication management. The IC card management program is an operating command program designed in accordance with the requirements of GB18240.2-2003 for tax control IC cards. It can be divided into basic commands and extended commands. Basic commands include file operations, reading and writing records, generating random numbers, internal and external authentication, getting responses, application locking, etc.; special commands for tax control cards include card registration, invoicing, and daily transaction signatures; special commands for user cards include registration signature, Distribute invoices, summarize tax reporting data and other functions. The memory management program is used to allocate addresses and manage the Flash storage space. This program is designed in a circular recording manner, and mainly completes the formatting, reading, writing, and searching of invoice details, daily transactions, and volume summary records. It is also responsible for the management of the address allocation table stored in SRAM and the recording of pointers and other data. The USB communication management program is designed in accordance with the low-speed USB1.1 specification and the requirements of the Human Interface Device (HID) category, and is used to complete bus enumeration and data communication transactions. This program mainly uses the Endpoint 0 (IN/OUT) control transmission method, and uses the input and output report (Report) format to exchange data with the host. 5.4 Hardware driver layer The hardware driver layer is the driver that enables each hardware device to implement low-level operations, including API library functions such as clock, IC card, Flash MEM, UART and USB. The clock function implements functions such as setting, reading, and writing clocks and calendars. The IC card function implements functions such as card insertion detection, card power on and off, card reset and card commands. The Flash MEM function implements functions such as erasing, reading, and writing of external Flash memory. UART and USB functions implement functions such as setting, receiving and sending data. Figure 3 6 Conclusion The design principle of the tax controller is introduced in the text. This design scheme has been debugged by the application function and can meet the basic needs of the product. It should be noted that in actual products, the modular design idea can be considered, that is to say, the hardware adopts a module + base plate architecture, the main processing and core hardware are concentrated on the module, and the power supply and connectors are placed on the base plate; the software The bottom layer can be encapsulated into the form of API functions for the upper layer. This makes it easier to meet different levels of demand, segment the tax control industry market, and is conducive to the positioning and selection of developers and suppliers. Through a variety of development and cooperation methods, we can achieve the purpose of reducing costs, improving efficiency and saving time.
Reference address:Application of μPSD32xx microcontroller in tax controller
Previous article:Design of time/displacement commutation controller based on AT89C51
Next article:Using microcontroller PWM signal for steering gear control
- Popular Resources
- Popular amplifiers
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- This circuit is for audio amplification. Please explain it to me.
- Modification of 4-20mA two-wire passive digital display meter Part 10 (Small task completed)
- Looking for AD component integrated library package library
- TMS320C6678 Evaluation Module
- Power Line Communication Simulation Reference Design for RS-485
- Buck circuit ripple test oscilloscope settings problem
- [RISC-V MCU CH32V103 Review] RTC Electronic Clock
- 2596 ADJ proportional resistance selection
- Reference design of a true wireless headset charging box with ultra-low standby power consumption
- Is there any D/E power amplifier related information recommended?