USB disconnect detection

USB disconnect detection

USB hosts and USB devices also need to have the ability to detect disconnection.

  • If the USB host cannot detect the removal of the USB device, its available resources will become less and less, such as assignable USB device addresses, assignable power resources, and available bus bandwidth.

  • If a USB device (especially a self-powered USB device) cannot detect its disconnection from the USB host, it may also cause some problems, such as it may not work properly when it is connected again.

USB device disconnection with Vbus detection

insert image description here

USB device disconnect without Vbus detection

insert image description here

Detection of disconnection on the USB device side

Same as USB device connection detection, the device side also realizes disconnection detection through the detection of Vbus.

For USB devices that only use USB bus power, when the device is removed from the USB host, the device is in an endpoint state and cannot continue to function. In this case, it is pointless to discuss disconnection detection. Subsequent discussions are based on the premise that the device can continue to work when the device is removed from the USB host.

For USB devices that do not support Vbus detection, the same as the connection detection, it can be detected by the interrupt generated by the change of D+ and D- signals when it is disconnected, supplemented by the status of real-time D+ and D- signals.

For a USB device that supports Vbus detection, once it detects that the voltage on the Vbus is lower than Vbsvld (4.01V), it can be considered that the device has been disconnected from the USB host. At this time, the USB device needs to remove the pull-up resistors on D+ and D- to ensure that the initial state of the next connection detection is correct.

  • For low-speed devices, remove the pull-up resistor on D-.
  • For full-speed devices, remove the pull-up resistor on D+
  • For high-speed devices, since the pull-up resistors have been removed in high-speed mode, there is no need to remove the pull-up resistors.

Detection of disconnection on the USB host side

Low/Full Speed ​​Devices

After the USB device is removed from the USB host, the D+ and D- of the USB host end will become 0V due to the pull-down 15KΩ resistor at the host end. The USB2.0 protocol stipulates that when the voltage of D+ or D- at the host end is less than 0.8V and lasts for Tddis (minimum value is 2us), the USB host considers that the USB device has been disconnected from the USB host port.
insert image description here
insert image description here
insert image description here

high speed equipment

When the USB device works in high-speed mode, the signal output voltage on D+ and D-, such as high-speed idle state voltage (high-speed idle level), high-speed digital signal high-level voltage (high-speed data signaling high) and full-speed device are not the same, so when detecting the disconnection of high-speed USB devices, the detection standards of D+ and D- are different from those of full-speed devices.

The USB2.0 protocol stipulates that for a high-speed host connected to a high-speed device, when the differential signal level difference between D+ and D- is not less than 625mV, the disconnection detection module of the high-speed host must consider that the USB device has been disconnected.

The high-speed host's disconnect detection block must not assume that the USB device has disconnected when the differential signal level difference between D+ and D- is no greater than 525mV.

The USB host will detect the packet end signal of each high-speed start of frame (SOF). When the packet end voltage is greater than the detection voltage, it means that a device is disconnected. It should be noted that in practical applications, the disconnection detection voltage of high-speed devices may be between 525-625mV, and the disconnection detection voltage of different hosts may be different.

Since the high-speed host judges whether the device is disconnected by detecting the end of the packet at the beginning of the frame, and the time interval between the beginning of the frame is 125us, when the device is disconnected, the host can detect that the device has been disconnected within 125us at most. open.

Guess you like

Origin blog.csdn.net/tyustli/article/details/130546811
usb
usb