Practical USB interface design based on CH371

Publisher:skyshoucangLatest update time:2012-06-06 Source: 单片机及嵌入式系统应用 Keywords:CH371 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Universal Serial Bus (USB) 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 Nerthern 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 12Mb/s, USB2.0 protocol supports 480Mb/s), 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 interfaces generally requires designers to have a deep understanding of USB standards, firmware programming and driver writing, which limits the development and use of USB interface products by general hardware engineers. The USB interface chip CH371 we use in the portable wireless meter reading system is easy to use, has excellent performance and is low in price. As long as a general hardware engineer is familiar with microcontroller programming and simple VB or VC application programming, he can easily develop the corresponding USB product in a very short period of time.

1 Introduction to the USB bus universal interface chip CH371

CH371 is a universal interface chip for USB bus, as shown in Figure 1. On the local side, 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, DSP and other controllers. In the computer system, the supporting software of CH371 provides a simple and easy-to-use operation interface. Communicating with the local microcontroller is like reading and writing files on 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. Using CH371, you can easily upgrade parallel and serial port products to USB interface without understanding any USB protocols or firmware programs, or even drivers. It has the following features:

*Shields the USB protocol and provides an end-to-end connection between the computer application layer and the local end.

*Two communication modes: one-way data flow mode, request plus response mode, support pseudo interrupt.

*Automatically complete the USB configuration process without any processing by the local controller.

*Standard USB V1.1 interface, plug and play, D+ pin built-in pull-up resistor.

* Built-in 4 endpoints, supporting USB control transfer, bulk transfer, and interrupt transfer.

* Generic Windows driver, providing device-level interface and application-layer interface.

*Universal local 8-bit data bus, 4-wire control, i.e. read enable, write enable, write select input, interrupt output.

* Occupies 16 addresses, and can choose direct address mode or multiplexed address mode.

* Built-in input and output buffer, which notifies the local controller to transmit data in interrupt mode.

*Built-in hardware-implemented I2C master interface, the application layer can directly read and write external I2C slave devices.

* In master control mode, it can provide 16 input signal lines or 12 independently controlled output signal lines.

* Built-in power-on reset, providing high-level active reset output and low-level active reset output.

* Built-in optional watchdog circuit Watch-Dog to provide monitoring for the local controller. [page]

2 Hardware design based on CH371 USB interface

Figure 2 shows a simplified diagram of the hardware interface between CH371 and MCU. The hardware connection of MCU AT89C52 is relatively simple, mainly because there are no special requirements in the design of the system, such as 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 function of the serial EEPROM 24C01 with I2C interface is 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 dynamic link library provided to easily complete the reading and writing of the serial EEPROM. In the system design, there can also be no EEPROM. CH371 will use the default VID, PID, product descriptor and power descriptor, and there is no device serial number.

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 1 and 4 of the USB connector; the shell of the 12MHz crystal oscillator is best grounded; the impedance matching resistor is 80Ω~150Ω.

3. Information transmission software implementation process

The simplified flow chart of the lower computer data upload subroutine is shown in Figure 3.

The interrupt service program flow of the lower computer is shown in Figure 4.

For the computer application layer program, after loading the universal driver of CH371 provided by WINCHIPHEAD on the computer, you don't need to consider the USB communication protocol, firmware program, driver, automatic configuration process and underlying data transmission process. You only need to compile your own application program with VB or VC according to the interface function of the dynamic link library provided.

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, and high reliability. I believe that there will be more and more new USB interface products based on CH371.

Keywords:CH371 Reference address:Practical USB interface design based on CH371

Previous article:CAN bus isolation expansion design based on serial peripheral interface (SPI)
Next article:MCS-51 single chip computer address pointer and its application

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号