Enumeration process for USB devices


The enumeration process of a USB device is a key procedure where the host identifies the device, allocates resources, and establishes communication after the device is connected to the USB host. This process is host-initiated and completed through a series of data interactions. The specific steps are as follows:

1. Physical Connection and Detection of the Device

When a USB device is plugged into the USB port of the host, the host detects the device connection by sensing the pull-up resistors (1.5kΩ) on the D+ (for full-speed/high-speed devices) or D- (for low-speed devices) lines:

  • Full-speed/high-speed devices pull the D+ line to a high level, while low-speed devices pull the D- line to a high level.
  • Upon detecting the level change, the host confirms the connection of a new device and starts supplying power (initially providing 100mA current).

2. Resetting the Device (Reset)

The host sends a reset signal to the device by pulling both USB data lines (D+ and D-) to 0V and holding them for at least 10ms, putting the device into the Default State.
After reset, the device’s address is reset to 0 (default address), and it prepares to receive control transfer commands from the host.

3. Reading the Device Descriptor

The host sends a Get Descriptor request to the device using the default address (0) to obtain basic device information, including:

  • Device type, USB protocol version (e.g., USB 2.0, USB 3.0), maximum packet size (for the default Endpoint 0), vendor ID (VID), product ID (PID), etc.
    The device responds to the request via Endpoint 0 (a mandatory control endpoint for all USB devices) and returns the device descriptor.
    The host adjusts communication parameters (e.g., the packet size for Endpoint 0) based on the “maximum packet length” in the descriptor to prepare for subsequent interactions.

4. Assigning a Unique Address

The host assigns a unique USB address (an integer between 1 and 127) to the device and sends it via a Set Address request.
Upon receiving the address, the device confirms and stores it. Subsequent communications will use this address, and the device will no longer respond to requests sent to the default address (0).

5. Reading Detailed Descriptors

Using the newly assigned address, the host sends another Get Descriptor request to retrieve more detailed descriptors, including:

  • Configuration Descriptor: Contains device configuration information such as power supply mode, maximum current requirement, and number of interfaces.
  • Interface Descriptor: Describes the functional interfaces of the device (e.g., audio, storage, communication), including interface type and number of endpoints.
  • Endpoint Descriptor: Defines attributes of each endpoint in the interface, such as transfer type, direction, maximum packet size, and polling interval.
  • String Descriptor (optional): Contains human-readable information like manufacturer name, product name, and serial number (encoded in Unicode).

6. Configuring the Device (Set Configuration)

Based on the configuration descriptor returned by the device, the host selects an appropriate configuration (if the device supports multiple configurations) and notifies the device to enable it via a Set Configuration request.
After confirming the configuration, the device enters the Configured State and initializes internal circuits according to the configuration parameters (e.g., enabling endpoints, adjusting power supply mode).
At this point, the host may adjust the supply current according to the device’s requirements (up to 500mA, as declared in the descriptor).

7. Loading the Driver

The host searches for a matching driver in the system based on the VID (Vendor ID) and PID (Product ID) in the device descriptor.
If a driver is found, the host loads it and completes device initialization; if not, the device may be marked as an “unknown device.”

8. Completing Enumeration and Establishing Communication

After the enumeration process, the device enters the Configured State, and the host can perform data transmission with the device (e.g., bulk transfer, interrupt transfer) via the assigned address and endpoints.

Core Significance of Enumeration

  • Enables automatic device recognition by the host without manual address or parameter configuration.
  • Ensures consistent communication protocols and data formats between the device and the host.
  • Reasonably allocates USB bus resources (e.g., addresses, bandwidth) to avoid device conflicts.

This process is the core implementation of USB’s Plug-and-Play feature, typically completing within a few hundred milliseconds.


了解 Ruigu Electronic 的更多信息

订阅后即可通过电子邮件收到最新文章。

Posted in

Leave a comment