USB connection and detection

The two ends of USB communication are respectively called: HOST (master device/USB host) and Device (slave device/USB device). At the same time, USB devices are mainly divided into two categories in terms of function: hubs and functional devices.

The hub, the most common one is the USB expansion dock used in our daily office, which is a connector to realize the USB star topology. It is mainly used to expand the USB port of the USB host. There is one uplink port and multiple downlink ports. The uplink port is usually a USB host, and the downlink port is usually a USB function device or other hubs. At the same time, it supports speed conversion. When USB devices of different speeds are connected to the hub at the same time, the upstream port will communicate at the maximum transmission speed. After reaching the hub, the hub will perform speed conversion according to the USB devices of different speeds.
insert image description here

USB functional devices: This is very easy to understand, the most common functional devices are mouse, U disk, keyboard. It is an independent peripheral device, which can be a single function or a multi-function composite device. At the same time, it contains information describing its own functions and resource requirements, which is very important in the USB enumeration process.

USB2.0 speed

Mainly divided into the following three types.
Low speed: 1.5Mbps
Full speed: 12Mbps
High speed: 480Mbps

How is the device identified? The following editor will talk about it.

First of all, let’s understand the basic knowledge:
USB chirp signal is mainly divided into K and J. The USB rate is different, and the D+ D- state corresponding to the KJ state is also different.
insert image description here

USB connection and detection

When the USB host is connected to the device, it can not only determine the insertion and removal of the USB, but also determine the speed of the detected USB, which often occurs after the BC1.2 protocol.
insert image description here
When a low speed USB device is connected, the schematic diagram is as follows.
insert image description here
There is a 15K pull-down resistor on D+ and D-. At the same time, there is a 1.5K pull-up to 3.0V-3.6v pull-up source on D- (the pull-up power is provided by VBUS, so that when VBUS is removed, there will be no current in the pull-up resistor on D- and other speeds for the same reason) . At this time, observe the D+ and D- waveforms, D- because of the pull-up source, the D- voltage value is about 3V .

When a full speed USB device is connected, the schematic diagram is as follows.
insert image description here
There is a 15K pull-down resistor on D+ and D-. At the same time, there is a pull-up source of 1.5K to 3.0V-3.6v on D+ (the pull-up power is provided by VBUS, so that when VBUS is removed, there will be no current in the pull-up resistor and the same reason for other speeds of D-). At this time, observe the D+ and D- waveforms. Due to the pull-up source of D+, the D+ voltage value is about 3V .

High speed
Compared with the former two, High speed is more complicated and needs to perform bidirectional detection . That is, the high-speed device needs to detect whether the host is a high-speed host or a full-speed host, and the high-speed host also needs to detect whether the device is a high-speed device or a full-speed device.
insert image description here
At the very beginning, high speed will appear at full speed, that is, there is a certain voltage on d+.
insert image description here
Then HOST pulls down D+ D- to enter the reset state, which we often call SE0.
insert image description here
Then the device began to inject a current of about 17.78mA into d-, and at the same time, its own line impedance was equivalent to 45R.
insert image description here
The voltage value of D- is about 17.78mA*45R=0.8V, which we call chirp K signal. And the duration is about 1-7ms. insert image description here
When the host detects the chirp k signal, within 100us after the chirp K signal, the host will continue to inject a current of 17.78mA into D+ D-, so there will be continuous KJKJKJ signals and each K and J signal Can not be interrupted, the duration of K and J is about 40-60us.
insert image description here
Whether the high-speed host recognizes the high-speed device or the high-speed device recognizes the high-speed host, we will find that, after all, the host sends the current source to d+ d-, so the Chirp K signal is consistent with the Chirp KJ signal level.

When the device is informed that it is a high-speed host, it will switch to high-speed mode within 500us and disconnect the 1.5K pull-up resistor. At the same time, it will enable the internal d+ d- high-speed terminal resistor 45R to go to the ground. At this time, there are a pair of 45R resistors to the ground compared with the previous ones.
insert image description here
Then the voltage on d+ and d- will be reduced to half accordingly: 17.78*22.5R=400mV, enter the high-speed state. insert image description here
The high-speed signal amplitude is 0.4V, which is different from full-speed and low-speed, which is 3V.

After sending several KJ signals, Hub sends SE0 reset signal again, and then enters 480Mbps communication.

Guess you like

Origin blog.csdn.net/weixin_43772512/article/details/126572702
usb
usb