Linux-driven design hardware foundation (4) USB interface and bus

2.3.4 USB

    USB (Universal Serial Bus) was proposed in 1995 by Intel, Microsoft and other manufacturers to solve the contradiction between the increasing variety of computer peripherals and the limited motherboard slots and ports. Supports the advantages of plug and play and hot plugging.

    USB 1.1 includes full-speed and low-speed modes. The low-speed mode has a rate of 1.5Mbit/s and supports some devices that do not require large data throughput and high real-time performance, such as mice. The full-speed mode is 12Mbit/s, and peripherals with higher speed can be connected. In USB 2.0, a high-speed mode is added, and the data transfer rate reaches 480Mbit/s, half-duplex, which can meet the needs of higher-speed peripherals. And USB 3.0 (also known as Super Speed ​​USB) has a maximum transfer bandwidth of up to 5.0Gbit/s (640MB/s), full duplex.

    The mechanical connection of the USB 2.0 bus is very simple. 4-core shielded wires are used. One pair of differential wires (D+, D-) transmits signals, and the other pair (VBUS, power ground) transmits +5V DC. The USB 3.0 cable is designed with 8 internal lines. Except for VBUS and power ground, the other 3 pairs are data transmission lines. The two USB 2.0 compatible lines, D+ and D-, are retained, and SSRX and SSTX lines specially designed for USB 3.0 have been added.

    In an embedded system, if the circuit board needs to be connected to a USB device, it needs to provide a USB host (Host) controller and connector; if the circuit board needs to be used as a USB device, it needs to provide a USB device adapter and connector. Most SoCs integrate a USB host controller (to connect USB peripherals) and a device adapter (such as a phone that acts as a USB stick). Figure 2.14 shows the physical topology of a USB system consisting of USB hosts, devices, and Hubs.


Figure 2.14 Physical topology of USB

    Each USB device will have one or more logical connection points in it, and each connection point is called an endpoint. USB provides a variety of transmission methods to meet the needs of various devices, an endpoint can choose one of the following transmission methods.

1. Control transmission method

Control transmission is bidirectional transmission, and the amount of data is usually small. It is mainly used to query, configure and send general commands to USB devices. All USB devices must support the standard request (Standard Request), control transfer mode and endpoint 0.

2. Synchronous transmission method

Isochronous transmission provides a certain bandwidth (computer network bandwidth refers to the highest data rate that the network can pass, how many bits per second) and interval time, it is used for time-critical and fault-tolerant streaming data transmission, or with For instant applications requiring constant data transfer rates. For example, when transmitting voice services, it is a good choice to use synchronous transmission. Isochronous transfers are also often referred to as "Streaming Real-time" transfers.

3. Interrupt transmission mode

Interrupt mode transfer is unidirectional, for the USB host, there is only input. The interrupt transmission mode is mainly used to regularly query whether there is interrupt data to be transmitted.

4. Bulk transmission method

Bulk transmission is mainly used in the transmission and reception of batch data without bandwidth and interval requirements, and it requires guaranteed transmission. Printers and scanners fall into this category.

While USB 3.0 adds a Bulk Streams transmission mode, the Bulk mode of USB 2.0 only supports one data stream, while the Bulk Streams transmission mode can support multiple data streams, and each data stream is assigned a Stream ID (SID) , each SID corresponds to a host buffer.

In the USB architecture, the hub is responsible for detecting the connection and disconnection of the device, using its interrupt IN endpoint (Interrupt IN Endpoint) to report to the host. Once it learns that a new device is connected, the host will send a series of requests to the hub attached to the device, and the hub will establish a communication channel between the host and the device. Then the host sends various requests to the device through endpoint 0 by means of control transmission, and the device replies with corresponding information after receiving the request from the host, and performs enumeration operations. Therefore, the USB bus has the ability to be hot-swappable.
















Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325994473&siteId=291194637