Design of Practical USB Interface Based on CH371

Abstract: A hardware design and software implementation based on the CH371 practical USB interface is given. The USB interface has the characteristics of simple hardware interface, easy software preparation, no need to understand any USB protocol or firmware program or even driver, etc. It is a very suitable USB interface for engineering applications.

Universal Serial Bus (Universal Serial Bus) is a new generation of bus interface standards jointly launched by Intel, Compaq, Digital, IBM, Microsoft, NEC, Nethern Telecom and seven world-renowned computer and communication companies. As a high-speed communication interface between PC and peripherals, USB has flexible connection, hot swappable, an interface suitable for a variety of devices, high speed (USB1.1 protocol supports 12Mb / s, USB2.0 protocol supports 480Mb / s), automatic configuration, no need to locate and run the installation program, can provide power for peripherals, low power consumption, low cost, high reliability and other advantages, so it is widely used in digital cameras, portable instruments, portable storage devices and other products application.

However, the development of the USB interface generally requires designers to have a deeper understanding of the USB standard, Firmware (firmware) programming and driver programming, etc., thus limiting the development and use of USB interface products by general hardware engineers. The USB interface chip CH371 that we use in portable wireless meter reading systems is easy to use, has excellent performance, and is inexpensive. As long as you are familiar with microcontroller programming and simple VB or VC application programming, general hardware engineers can do it in a very short period. It is easy to develop corresponding USB products.

1 Brief introduction of CH371, the universal interface chip of USB bus

CH371 is a universal interface chip for USB bus, as shown in Figure 1. 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 and other controllers. In the computer system, the supporting software of CH371 provides a simple and easy-to-use operating interface, and communication with the local single-chip microcomputer is like reading and writing files in the hard disk. CH371 shields all protocols in USB communication and provides an end-to-end connection between the computer application layer and the local controller. Using CH371, you can easily upgrade the parallel and serial products to the USB interface without understanding any USB protocol or firmware program, or even the driver program. It has the following characteristics:

* Shield USB protocol, provide end-to-end connection between computer application layer and local end.

* Two communication modes: one-way data flow mode, request plus reply 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 has built-in pull-up resistor.

* Built-in 4 endpoints, support USB control transmission, batch transmission, interrupt transmission.

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

figure 2

* Universal local 8-bit data bus, 4-wire control, namely read strobe, write strobe, write-select input, and interrupt output.

* Occupy 16 addresses, can choose direct address mode or multiplex address mode.

* Built-in input and output buffer, notify the local controller to transmit data in an interrupted way.

* I2C master interface realized by built-in hardware, application layer can directly read and write external I2C slave device.

* In the main control mode, 16 input signal lines or 12 independently controlled output signal lines can be provided.

* Built-in power-on reset, provide high-level effective reset output and low-level effective reset output.

* Built-in optional watchdog circuit Watch-Dog, provide monitoring for local controller.

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 to the MCU AT89C52 is relatively simple, mainly in the design of the system, such as the selective connection of the crystal oscillator and the reset circuit, etc. There are no special requirements, and the reset signal of the CH371 reset circuit can be completely adopted by the CH371 reset. 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 addresses are different, you can mount multiple peripheral chips with I2C interface. Users can use the provided dynamic connection library Function, it is very convenient to complete the read and write to 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 serial number of the device.

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 is preferably grounded; the impedance matching resistance is 80Ω ~ 150Ω.

3 Information transmission software implementation process

The schematic diagram of the subprogram data upload subroutine is shown in Figure 3.

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

For the computer application layer program, after loading the CH371 universal driver provided by WINCHIPHEAD on the computer, it is no longer necessary to consider the USB communication protocol, firmware program, driver, automatic configuration process and the underlying data transmission process. Just need to compile your own application program with VB or VC according to the provided interface function of the dynamic link library.

Conclusion

From the current practical application, the design of the system is successful. Especially the USB interface based on CH371 has the characteristics of simple hardware design, easy software programming, low cost, fast transmission rate and high reliability. It is believed that there will be more and more new products of USB interface based on CH371.

For the 22kV Oil Immersed Power Transformer, we can produce capacity upto 420MVA. We use the best quality of raw material and advance design software to provide low noise, low losses, low partial discharge and high short-circuit impedance for power transformer.

Our power transformer are widely used in national grid, city grid, rural grid, power plant, industrial and mining enterprise, and petrochemical industry.

220kV Power Transformer

220Kv Transformer,220Kv Power Transformer,High Quality Power Transformer,Oil Immersed Transformer

Hangzhou Qiantang River Electric Group Co., Ltd.(QRE) , https://www.qretransformer.com