1 Introduction
USB (Universal Serial Bus) is a new generation bus interface standard jointly launched by seven world-renowned computer and communication companies, including Intel, Compaq, Digital, IBM, Microsoft, NEC, and Northern Telecom. As a high-speed communication interface between PCs and peripherals, USB has the advantages of flexible connection, hot pluggability, one interface suitable for multiple devices, high speed (USB1.1 protocol supports 12Mbps, USB2.0 protocol supports 480Mbps), automatic configuration, no need to locate and run installation programs, power supply for peripherals, low power consumption, low cost, high reliability, etc., so it is widely used in digital cameras, portable instruments, portable storage devices and other products.
However, the development of USB interface generally requires designers to have a deep understanding of USB standards, firmware programming and driver programming, which limits the development and use of USB interface products by general hardware engineers. The USB interface chip CH371 used in our portable wireless meter reading system is simple to use, has excellent performance and is inexpensive. As long as you are familiar with single-chip microcomputer programming and simple VB or VC application programming, general hardware engineers can easily develop corresponding USB products in a very short period of time. Figure 1 shows the principle of wireless meter reading and management system
block diagram.
Figure 1 Principle block diagram of wireless meter reading and management system
2 Introduction to the USB bus universal interface chip CH371
CH371 is a universal interface chip for USB bus.
As shown in Figure 2, at the local end, CH371 has an 8-bit data bus and read, write, chip select control lines and interrupt output, which can be easily connected to the system bus of microcontrollers,
DSPs
, MCUs and other controllers; in the computer system, the supporting software of CH371 provides a simple and easy-to-use operation interface, and communicating with the local microcontroller is like reading and writing files in the hard disk. CH371 shields all protocols in USB communication and provides end-to-end connection between the computer application layer and the local controller. Based on CH371, you can easily upgrade parallel and serial port products to USB interfaces without knowing any USB protocols or firmware programs or even drivers.
Figure 2 CH371 chip schematic
It has the following features:
(1) Shielded USB protocol, providing end-to-end connection between the computer application layer and the local end;
(2) Two communication modes: unidirectional data flow mode, request plus response mode, support for pseudo interrupts;
(3) Automatically complete the USB configuration process, without the need for the local controller to do any processing;
(4) Standard USB V1.1 interface, plug and play, D+ pin with built-in pull-up resistor;
(5) Built-in 4 endpoints, support USB control transfer, bulk transfer, and interrupt transfer;
(6) Universal Windows driver, providing device-level interface and application layer interface;
(7) Universal local 8-bit data bus, 4-wire control: read enable, write enable, chip select input, interrupt output;
(8) Occupies 16 addresses, can choose direct address mode or multiplexed address mode;
(9) Built-in input and output buffer, notifying the local controller to transfer data in interrupt mode;
(10) Built-in hardware-implemented I2C master interface, the application layer can directly read and write external I2C slave devices;
(11) In master control mode, it can provide 16 input signal lines or 12 independently controlled output signal lines;
(12) Built-in power-on reset, providing high-level effective reset output and low-level effective reset output;
(13) Built-in optional watchdog circuit Watch-Dog, providing monitoring for the local controller. [page]
3 Hardware Interface Design of CH371 in Wireless Meter Reader Based on Single Chip Microcomputer
Figure 3 shows a simplified diagram of the hardware interface between CH371 and MCU, so the hardware connection of MCU AT89C52 is relatively simple, mainly because in the design of this system, there are no special requirements for the selection and connection of the crystal oscillator and the reset circuit, and the reset of CH371 can completely use the reset signal generated by the reset circuit of the single-chip microcomputer. The serial EEPROM 24C01 with I2C interface is used to store the product's VID, PID, device serial number and other information. As long as the address is different, multiple peripheral chips with I2C interface can be connected. Users can use the functions of the provided dynamic link library to easily complete the reading and writing of the corresponding information to the serial EEPROM. Of course, there can be no EEPROM in the system design. CH371 will use the default VID, PID, product descriptor and power descriptor, and there is no device serial number.
Figure 3. Hardware interface diagram of CH371 and MCU
It should be noted that it is best to connect a 100μF electrolytic capacitor and a 0.1μF monolithic or ceramic capacitor between USB connectors 1 and 4; the shell of the 12MHz crystal oscillator is best grounded; the impedance matching resistor can be between 80Ω and 150Ω.
4 Information transmission software implementation process
(1) Sub-program for uploading data to the lower computer
The simplified flow chart is shown in Figure 4.
Figure 4 Data upload subroutine flow chart
(2) Lower computer interrupt service program
The flow chart is shown in Figure 5.
Figure 5 Flowchart of interrupt service program of lower computer
(3) Computer Application layer programs
After loading the universal driver of CH371 provided by WINCHIPHEAD on the computer, we no longer have to consider the USB communication protocol, firmware program, driver, automatic configuration process and underlying data transmission process. We only need to compile our own application with VB or VC according to the interface function of the dynamic link library provided.
5 Conclusion
From the current practical application, the system design is successful. In particular, the USB interface based on CH371 has the characteristics of simple hardware design, easy software programming, low cost, fast transmission rate, high reliability, etc. I believe that there will be more and more new USB interface products based on CH371.
Previous article:Design of handheld monitoring equipment for satellite communication vehicle-mounted station based on MSP430
Next article:Grain depot wireless temperature and humidity monitoring system based on RF module nRF905
Recommended ReadingLatest update time:2024-11-16 16:22
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Image acquisition and processing system for panoramic map applications
- Teach you to learn 51 single chip microcomputer-C language version (Second Edition) (Song Xuefeng)
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
- BSL source code for DM642EVM
- A record of the development experience of a new embedded CPU chip CC2540
- if(Data==1)start=1; Why is there no space after if and before start in this sentence? This will not cause errors during compilation.
- Xiaomi Robot Vacuum Cleaner Features and Chip Parameters
- [Raspberry Pi 4B Review] Raspberry Pi 4 pin functions and operation methods
- Live: Embedded to Cloud Journey with PIC and AVR MCUs from the Microchip Ecosystem Part 2
- Purgatory Legend-RAM War
- [CY8CKIT-149 PSoC 4100S Review] + Familiar with the development environment
- How to write program control for AT28C64
- Motor control design, accuracy? resolution? arc minutes?