A new type of USB communication technology

The Universal Serial Bus (Universal Serial Bus, USB for short) was proposed in 1995, and was defined by 7 companies including Compaq, Digital Equipment Corp (now Compaq), IBM, Intel, Microsoft, NEC and Northern Telecom Promotion. Because USB technology is easy to use, hot-swappable, fast, and low power consumption, USB communication technology is widely used. Based on this, this paper proposes a USB communication technology based on CH372 chip, which can realize the USB communication between the microcontroller and the computer.

1 Introduction to CH372

There are many types of USB interface chips, which can be basically divided into two categories: one is a USB interface chip with general CPU functions, and the other is a pure USB interface chip without an integrated CPU. CH371, CH372, CH375 chip series is the latter. In this study, because the USB interface is only used for data transmission functions such as reading and writing, and the data processing and signal conversion parts need to be controlled by the single-chip microcomputer, the pure USB interface chip CH372 is used in conjunction with the AT89C52 single-chip microcomputer. On the microcontroller side, CH372 has an 8-bit data bus and read, write, chip select control lines and interrupt output, which can be easily hooked up to the system bus of microcontrollers / DSP / MCU / MPU and other controllers; on the computer side, the matching of CH372 The software provides a simple and easy-to-use operation interface, and communication with the local MCU is as convenient as reading and writing files.

Compared with ordinary general-purpose serial chip, CH372 chip has the following advantages:

1) Full-speed device interface, compatible with USB2.0, plug and play, peripheral components only need crystal and capacitor;

2) Provide a pair of main endpoints and a pair of auxiliary endpoints to support control transmission, batch transmission, and interrupt transmission;

3) It has a trouble-free built-in firmware mode and a flexible external firmware mode. The built-in firmware mode shields the relevant USB protocol, automatically completes the standard USB enumeration configuration process, and does not require any processing by the local controller, simplifying the single chip Firmware programming

4) Universal Windows driver provides device interface, and API application layer interface is provided through DLL;

5) Universal local 8-bit data bus, 4-wire control: read strobe, write strobe, chip select input, interrupt output;

6) The main endpoint uploads and downloads 64 bytes of buffer each, and the auxiliary endpoint uploads and downloads 8 bytes of buffer.

2 System hardware circuit design

The CH372 chip provides a universal passive parallel interface at the local end, including: 8-bit bidirectional data bus D7 ~ D0, read strobe input pin RD #, write strobe input pin WR #, chip select input pin CS #, Interrupt output pin INT # and address input pin A0. Through the passive parallel interface, CH372 can be easily connected to various 8-bit microcontrollers, DSP, MCU chips, and can coexist with multiple peripheral devices. Based on the information and parameters of CH372 chip. The USB communication circuit of the MCU end of the CH372 chip is given here, as shown in Figure 1. At the same time, the chip can communicate with the computer through the ordinary USB transmission line, J1 in Figure 1 is the USB connector.


The matters needing attention in the design of CH372 chip circuit and PCB board are:

1) In order to reduce electromagnetic radiation and reduce interference from the outside, the metal shell of the crystal Y1 of the PCB board is grounded;

2) In order to reduce the interference to the clock signal, PCB design should not be routed near the crystal and the oscillating capacitor as much as possible, especially not to use power lines and strong signal lines with transient inrush current such as relays and motors;

3) Separate power supply to the USB socket, so that the capacitor charging process when the USB device is just plugged in does not affect the microcontroller and CH372:

4) Connect a current limiting resistor or inductance in front of the USB socket;

5) The layout of the PCB board should be reasonable, the resistance and capacitance should be aligned, the temperature-sensitive devices should be placed far from the power supply, and the board should be copper-clad.

3 Software design

CH372 provides an end-to-end connection between the computer application layer and the local MCU. On this basis, the USB interface can choose one-way data flow and request plus reply two communication methods. The communication is realized by request plus response, which is actively requested by the computer, and the single-chip microcomputer passively completes the data transmission by passive response. In the process of programming, three data transmission modes are agreed, which are determined by computer data transmission. They are:

1) The computer downloads the data 01H, and the single-chip computer uploads the parameters of the file that stores the data;

2) The computer downloads data 02H and 8-byte parameters. The 8-byte parameters include the address and number of data stored. The single-chip computer analyzes the parameters by calling relevant subroutines and uploads the corresponding data;

3) The computer downloads data 03H, and the single-chip computer executes the operation command to close CH372.

3. One-chip computer end procedure

Programs are written in assembly language on the MCU side. In the process of program design, the reliability and stability of the system and the intuitive needs of the debugging process are taken into account, so the program is written in assembly language. The program flow is shown in Figure 2.


Multi Core Power Cable

Multi Core Power Cable,Multi Core PVC Insulated Cable,Flexible Multi Core Power Cable,XLPE Multi Core Power Cable

Huayuan Gaoke Cable Co.,Ltd. , https://www.bjhygkcable.com

This entry was posted in on