Brief description of USB protocol

Tue Apr 18 20:55:05 CST 2023

Brief description of USB protocol

What is the USB protocol?

USB, Universal Serial Bus, is a communication protocol for computers to interact with peripheral devices for data. 

In the old days when computers were just emerging, to connect a new device, you needed to power down the computer, connect the device, configure the hardware, and power up and run again, a process that was quite time-consuming and laborious. 

The USB bus protocol was created in order to have this hot-plugging feature to access devices at will.

The USB bus is available today as USB 1.0, USB 1.1, USB 2.0, USB 3.0, and USB 4.

The USB protocol uses a master-slave working mode, which means that only data communication between the host and the slave is possible.

But this also raises a drawback: that is, the host cannot communicate with the host and the slave with the slave.

0_Brief-description-of-USB-protocol-Hornmic

Transmission structure of the USB protocol

The standard USB protocol transmission structure looks like this (device side):

1_standard-USB-protocol-transmission-structure

The USB protocol uses a differential transmission mode, and thus has two data lines D+ and D-.

In low and full speed mode, the voltage transfer mode is used, and in high speed, the current transfer mode is used.

The reason for the two long pins and two short pins transmission structure is to support hot-plugging.

When the USB device is plugged into the host, VCC and GND are given priority to be turned on; when the device is unplugged, the D- and D+ data lines are given priority to be powered off.

The reason is simple, if D- and D+ are turned on before the power line, then at this time the power supply is 0, the voltage of the USB chip's IO port pins is likely to be greater than the power supply voltage, which can easily lead to chip latch-up, which may not work, or damage the chip, which requires power off and power on again.

Before there is no configuration, the maximum current of the data line is 100mA, after configuration, the maximum current of the data line is 500mA.

The data is transmitted in a small end-order manner, and in international standards, even the four lines of the USB protocol are color-coded, with VCC in red, GND in black, D- in white, and D+ in green.

Electrical characteristics of USB

In terms of electrical structure, the USB device is connected to the host as follows:

2_USB-device-connected-to-the-host

The D- and D+ data lines on the host side are each pulled down to ground by a 15KR resistor in series. When no USB device is plugged in, these two data lines are always low.

The D- or D+ data lines on the device side are connected in series with a 1.5KR resistor pulled up to 3.3V. Once the device is plugged into the host, then when the host captures its own D- or D+ being pulled high, it knows that a USB device is connected in, so that it detects that an external USB device is plugged in.

For the slave device whether D- or D+ series 1.5KR resistor, this will have to be decided by the mode of the transmission protocol, when configured to full speed or high speed, by D+ series resistor; when configured to low speed, it is D- series resistor.

Topology

The Host side with one or more USB host controllers, each USB host controller with one or more root hubs, the host controller is responsible for data processing, the root hub is responsible for providing a host controller and device connectivity interface;

Of course there is such a situation, when more and more devices, the interface is not enough, you need a special USB device on the scene, that is, a USB hub.

3_USB-physical-topology-Hornmic

It is possible to expand the original USB interface with more interfaces, but of course, the expansion is more, but also share a master controller, so the bandwidth is unchanged.

The host USB host controller and Root Hub can be seen in the Device Manager on the PC:

4_device-manager-usb-controller

Although it is said that a USB master controller can connect multiple devices, this connection is not in series or in parallel, but through a hub.

As shown, the main controller and the root hub are followed by a hub, which expands one or more USB ports into more ports, and more ports into more again, but this expansion is not endless.

5_Host-links-4-devices-through-Hub

6_USB-topology-is-pyramidal

Transmission process

Firstly, the master controller sends out data, which is transmitted through the hubs of each layer to the interface of the corresponding layer to the USB device;

The device receives the data, analyzes and processes it, and then sends back a set of data or an answer, which is first sent to a hub on this layer, then to a hub on a higher layer, all the way up to the main controller;

Finally, the main controller hands the data or answer to the computer for processing.

Coding method

No matter how advanced the USB protocol is, the essence of the actual data transmission on the transmitter side is 0 and 1.

USB uses the NRZI encoding method, where the level is flipped when the data is 0, and the level is not reversed when the data is 1.

When there are 6 consecutive bits of 1, a 0 is automatically filled in. The purpose of this is to prevent the level from not changing for a long time, which is not good for clock extraction. On the receiver side, the opposite is true: the filled 0 is automatically removed and the original data is restored.

This is the bit padding process.

Of course, this encoding process, the USB chip has been automatically processed, we just know that there are these details can be.

7_Signal-Diagram-Illustrating-Non-Return-Zero-Inversion-NRZI-Encoding-Scheme

The process of data transfer

Device side of the USB protocol to generate 0 and 1 data in the endpoint out of the composition of an interface, by the interface and constitute a configuration, by the configuration and constitute a device, and finally the information of this device to the host for data processing, the approximate process is this.

This information, is known by the descriptors that the host gets from the device, so the 0 and 1 data transmitted on the USB bus, which actually make up the descriptor data, is sent to the host. These data include: Device Descriptor, Configuration Descriptor, String Descriptors, Interface Descriptors, and Endpoint Descriptors.

8_USB-Descriptors-Hierarchy



HornmicLink Logo-Intelligent Connection Solutions-China USB Cable provider,Charging Cable,Hub Adapter,USB Charger manufacture

By HornmicLink_Henry @230418 21:06