Application of USB interface in serial communication
[Copy link]
Abstract: This paper introduces the application of USB interface in serial communication, discusses the conversion between USB interface and RS-232 interface and the simplified design of USB interface modem, and gives the actual product sample diagram. 1 USB Interface Introduction USB is the Universal Serial Bus, which can be hot-swapped and uses a daisy chain structure. It can connect up to 127 devices at the same time. The bus provides power and has error detection and correction functions to ensure correct data transmission. When USB is used on a PC, the operating system of the PC needs to support the USB protocol. At this time, the software on the PC consists of two parts: USB initialization software and operation part. The former constructs and defines a unique identifier for the peripheral, which is the so-called enumeration process, to obtain a description table for each peripheral. In addition, the USB host software is layered into various peripheral classes, such as large storage peripherals, communication peripherals, audio peripherals, human-machine interface peripherals, etc. The USB data line transmits differential signals. All communications are initiated by the root hub and replicated by the external hub. The connection is point-to-point and half-duplex. There is no clock signal on the USB data line, so the communication between nodes is asynchronous. The rated communication rate of all peripherals on the bus is 12MHz, and the peripherals receive signals from the bus using oversampling. The receiver relies on regular signal changes to maintain synchronization with the transmitter. The USB specification uses non-return-to-zero flipping to implement the transmission encoding of its data line. 2 USB to RS-232 Converter RS-232 is a popular interface. In MS-DOS, the four serial ports are called COM1, COM2, COM3, and COM4, and most Windows applications can have up to four peripherals, but if users want to expand more peripherals, they must use plug-in serial cards or external switch boxes. RS-232 is a point-to-point connection, and one serial port can only connect to one peripheral. USB is a multi-point, high-speed connection method, and the use of a hub can achieve more connections. The basic part of the USB interface is the serial interface engine SIE, which receives data bits from the USB transceiver, converts them into valid bytes and transmits them to the SIE interface; conversely, the SIE interface can also receive bytes and convert them into serial bits and send them to the USB bus. Figure 1 is a schematic diagram of a converter plus serial peripherals. There is a microcontroller at the converter and peripheral receiver ends. In fact, these two microcontrollers can be combined and can be implemented using MCS-51 series controllers or I2C bus microcontrollers. Figure 2 is a schematic diagram of a microcontroller using an external USB connection. The general microcontroller uses MCS-51, and the USB peripheral chip is Philips' PDIUSBD11. The chip has an I2C interface, and its SIE interface includes an interrupt and a large register for accessing the I2C bus. When a data packet arrives, PDIUSBD11 pulls its interrupt line low, and the microcontroller turns to the interrupt handler, first reading the interrupt status register of PDIUSBD11, and then reading the values of other registers to obtain the data packet type and data in the packet. An interrupt request is generated every time a data packet is transmitted. The interrupt handler monitors the control sequence and detects all errors. 3 Design of connecting 56kbps modem with USB The USB protocol includes a communication class that defines a structure to include all devices used for remote communication services and medium-speed network services. In this way, peripherals can identify themselves as peripherals of a communication class. 3.1 Traditional modem structure Traditional modems generally include: Microcontroller: to decode control codes (AT command set) Digital signal processor (DSP): modulates and demodulates signals Analog modulation and demodulation circuits Data access management circuit Isolator: Isolates high voltage or high current from telephone lines 3.2 Simplified design Since the maximum speed of the PC serial port is 115.2kbps, this will form a speed bottleneck in the structure of Figure 3. The RS-232 system includes two serial signal paths in opposite directions, which are used to transmit commands and data respectively, and commands and status must be interwoven with data; while USB supports separate command and data channels and allows independent status reporting. In the Windows operating system, the UniModem driver of the communication layer (as shown in Figure 4) can implement the modem command set. Microsoft's VCOMM port driver software can reposition the output originally oriented to the serial port and directly pass it to the class driver of the Windows peripheral driver module (WDM-Windows Device Driver Model), and the WDM class driver sends the output to the USB peripheral. The reverse order can send the input from the USB peripheral to the Uni-modem driver and finally return to the application. In addition, since the PC host has sufficient processing power, real-time signal processing can be fully realized while processing user applications, and Intel has retained the MMX instruction set in a certain processor. This instruction set has the advantages of DSP algorithms, and is implemented through "soft" processing. Compared with physical DSP chips, the signal processing algorithm of this instruction set can be easily upgraded. Through "soft processing", only the modulation stage, signal isolator and a data access manager are retained in the traditional modem. Figure 5 shows a simplified design with a transformer used as an isolator. This article discusses the application of USB interface technology in serial communication. By adding a microcontroller to the peripheral and using several communication classes supported by Windows, the design of the traditional USB interface modem is simplified. A simplified design of an actual modem is given in the article, and the modem can be simulated using LabView software and VB language.
|