Detailed flow of the USB enumeration process

Source: Internet
Author: User

Detailed flow of the USB enumeration process


The user plugs a USB device into the USB port, the host is powering the port, and the device is powered up at this time.
Host detection equipment.
The 1>hub uses an interrupt channel to report the event to host.
2>host sends the Get_port_status (read port status) Request for more device information.
The 3> hub detects whether the device is running at low speeds or at high speeds and sends this information to the host, which is a response to the get_port_status request.
The 4> host sends a set_port_feature (write port status) request to the hub, which requires it to reset the port.

The 5> hub resets the device.
The 6>host uses the chirp K signal to see if the full speed device supports high speeds.
7>host sends another Get_port_status request to determine if the device has exited from the reset state.
8>function device is now in default state and is ready to respond to the host control transfer in the endpoint 0 default channel. The default address of 00h,function device is to obtain up to 100mA of current from the bus.
9>host sends a get_descriptor (read device descriptor) message to determine the maximum packet size. The eight bytes of the device descriptor are bmaxpacketsize.
10> the host assigns an address by sending a set_address (write address) request, and the Function device is in device state at this time.
11>host sends Get_descriptor to get more information about the device. Host responds to the device request by sending a descriptor, and then sends all the secondary descriptors.
12>host Assign and load the device driver.
13>host by sending a set_configuration (write configuration) request, the host's device driver chooses a valid configuration and device is in the configuration state at this time.
The 14>host assigns drivers to the composite device interface.
15> If the hub detects a overcurrent phenomenon, or if the host requires the hub to turn off the power, the USB bus shuts down the device power supply. In this scenario, device and host cannot communicate, but the devices are connected.
16> If the device does not see any action on the bus within 3 milliseconds, it enters the suspend state, and the bus consumes the least amount of power in the suspended state of the device.

There is a similar one, as follows:


1) hub detection of new equipment
The host hub monitors the signal voltages for each port and is aware when new devices are plugged in. (Each of the two signal lines of the hub port has a 15kω pull-down resistor, and each device has a 1.5kω pull-up resistor in the d+.) When the PC and the device are connected with a USB cable, the device's pull-up resistor increases the signal line's potential and is therefore detected by the host hub. )
(2) The host knows when the new device is connected
Each hub has an interrupt transmission to report events on the hub. When the host knows about this event, it sends a GET_STATUS request to the hub to learn more about the message. The returned message tells the host when a device was connected.
(3) The hub re-set this new device
When the host knows that there is a new device, the host sends a SET_FEATURE request to the hub to request the hub to reset the port. The hub causes the device's USB cable to be at least 10ms in the restart (reset) state.
(4) The hub establishes a signal path between the device and the host
The host sends a GET_STATUS request to verify that the device is prompting for a restart state. One of the returned data indicates that the device is still in a reboot state. When the hub releases the restart status, the device is in default state, which means the device is ready to control transmission through the default process response of endpoint 0. That is, the device now uses the default address 0x0 to communicate with the host.
(5) Hub detection equipment speed
The hub detects whether the device is a low-speed device or a full-speed device by measuring the signal line (d+ or D) with a higher voltage at idle. (Full speed and high speed equipment d+ with pull-up resistor, low speed device D with pull-up resistor).
Below, the USB firmware is required to intervene.
(6) Get the maximum packet length
Host sends the Get_device_descriptor command specified by the USB protocol to address 0 to obtain the maximum packet length supported by the default control pipe and to wait for the USB device to respond for a limited period of time, the length The degree is contained in the BMaxPacketSize0 field of the device descriptor with an address offset of 7, so the host simply reads the first 8 bytes of the descriptor. Note that the host can only enumerate one USB device at a time, so only one USB device at a time can use the default address of 0.
The following operations are similar, the different operating system settings delay is not the same, for example, Win2K is a few milliseconds, if there is no response to send another command, repeat three times.
(7) Host assigns a new address to the device
The host assigns a unique address to the device by sending a set_address request. The device reads this request, returns a confirmation, and saves the new address. From this point on, all communication uses this new address and the device enters address state.
(8) The host re-sends the Get_device_descriptor command to the new address, which reads all the fields of its device descriptor to understand the overall information about the device, such as Vid,pid.
(9) The host loop sends the get_device_configuration command to the device, requiring the USB device to answer to read all configuration information.
(10) The host sends the get_device_string command, obtains the character set description (Unicode), for example the production quotient, the product description, the model number and so on.
(11) At this time the host will pop-up window, show the discovery of new equipment information, manufacturers, product descriptions, models and so on.
(12) According to Device_deor and device_configuration response, host to determine whether to provide USB driver, general Win2K can provide several categories of equipment, such as game joystick, storage, printers, scanners, etc., the operation is running in the background. But Win98 can not, so at this point will pop up a dialog box, asking for USB driver.
(13) After the USB device driver is loaded, the host sends the set_configuration (x) command request to select an appropriate configuration for the C device (x represents a non-0 configuration value). If the configuration is successful, the USB device enters the configuration state and can transfer data to and from the client software.
At this point, regular USB completes the configuration and connection work that it has to do. Check the registry to see that the corresponding project has been added and the device should be ready to use. However, the USB protocol also provides a number of user-selectable protocols, if the device does not answer, there will be no error, but will affect the function of the system

Detailed flow of the USB enumeration process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.