I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
What is Enumeration and Why are USB Descriptors Important?
Brendan Murphy

The USB Protocol

The USB protocol was introduced in 1996 as a way to institutionalize a more widespread, uniform cable and connector that could be used across a multitude of different devices. The idea was to simplify the connection of devices to and from a host computer. The protocol is currently maintained and regulated by the USB Implementors Forum or better know as USB-IF. This group sets standards that all USB devices must follow in order to be compliant with the technology and work properly across all USB compatible devices.

USB has a wide range of device types. Whether a user is plugging in a mouse and keyboard or connecting a flash memory drive, the process remains simple and seamless.  The USB specification was written specifically to provide this plug and play user experience. This experience is made possible by the USB enumeration process.

person using mouse and keyboard connect to computer via USB Photo by Maria Stewart via Pexels

What is Enumeration?

Enumeration within a USB system is a process where the host detects the presence of a device, determines what type of device is connected, and defines the speed at which to communicate. This process is important because different types of USB devices will communicate or interact with the host differently.

Referring back to the computer mouse and flash memory device, once connected to a host, these devices will behave differently because they have different functions. A mouse is a human interface device designed to provide a method for a user to interact with the host.  This device operates entirely different from a memory device such as a flash drive. A flash drive is used to read and write data to and from the computer. The memory device and mouse are different USB devices, yet the host computer knows how to interact with each device because of the USB device descriptors sent to the host during the enumeration process. The enumeration process goes through nine main steps as seen in the graphic below.

USB enumeration process USB Enumeration Process

 

What are USB Descriptors?

USB descriptors are presented to the host during the enumeration process. These descriptors tell the host what type of device is connected and how to properly communicate with it. There are four types of descriptors: Device Descriptors, Configuration Descriptors, Interface Descriptors, and Endpoint Descriptors.

Device Descriptor

Each USB device can only have a single Device Descriptor. This descriptor contains information that applies globally to the device, such as serial number, vendor ID, product ID, etc. The device descriptor also has information about the device class. The host PC can use this information to help determine what driver to load for the device.

Configuration Descriptor

A device descriptor can have one or more configuration descriptors. Each of these descriptors defines how the device is powered (e.g. bus-powered or self-powered), the maximum power consumption, and what interfaces are available in this particular setup. The host can choose whether to read just the configuration descriptor or the entire hierarchy (configuration, interfaces, and alternate interfaces) at once.

Interface Descriptor

A configuration descriptor defines one or more interface descriptors. Each interface number can be subdivided into multiple alternate interfaces that help more finely modify the characteristics of a device. The host PC selects a particular alternate interface depending on what functions it wishes to access. The interface also has class information which the host PC can use to determine what driver to use.

Endpoint Descriptor

An interface descriptor defines one or more endpoints. The endpoint descriptor is the last descriptor in the configuration hierarchy and it defines the bandwidth requirements, transfer type, and transfer direction of an endpoint. For transfer direction, an endpoint is either a source (IN) or sink (OUT) of the USB device.

Loading USB Drivers

Once these descriptors are shared, the host then loads the proper drivers needed to operate the device. USB driver files are installed on the host and provide the information that allows proper communication with the variety of USB device classes. These driver files provide the details to interpret the device descriptors to seamlessly interact with the USB device. Most USB devices are from a common specification-defined class and can rely on a standard driver that is automatically pulled and installed without the user knowing it.  However, with custom USB class devices, the user may need to download a special driver, provided by the developer, to successfully communicate with the USB device.

List of USB class types USB Device Classes

Why is USB Enumeration Important?

The enumeration process is a vital part of the USB architecture. Since USB has such a diverse set of device types, it is important that the host has a way to define how to communicate properly with each individual device. The enumeration process ensures that every USB connected device is recognized by the host to ensure proper data transfer. Without enumeration, a host is unable to define the device type and what type of data transfer to use, the interval at which to send data, or even the speed of communication.

Debugging the Enumeration Process

Total Phase has a variety of USB tools to help developers debug the enumeration process. In most USB debugging, developers find themselves running into issues when it comes to their devices not communicating with the host device as intended.  Total Phase offers a line of Beagle USB Protocol Analyzers that can help provide information on why the enumeration process may corrupted.

All of the Total Phase Beagle USB Protocol Analyzers capture and trace the enumeration process with great detail. Whether working with Low or SuperSpeed USB there is an analyzer to help. One of the most common Total Phase USB protocol analyzers is the Beagle USB 5000 v2 SuperSpeed Protocol Analyzer.

Beagle USB 5000 v2 SuperSpeed Protocol Analyzer Beagle USB 5000 v2 SuperSpeed Protocol Analyzer

The Beagle USB 5000 v2 SuperSpeed Protocol Analyzer non-intrusively monitors SuperSpeed/High-/Full-/Low-Speed USB traffic up to 5 Gbps. The Standard edition can monitor either USB 2.0 or USB 3.0 traffic, while the Ultimate edition can monitor USB 2.0 and USB 3.0 traffic simultaneously. This analyzer offers real-time display, search, and filtering of captured data, along with descriptor and USB class decoding. It also offers users the ability to perform USB 2.0/USB 3.0 advanced triggering with flexible state-based conditions on data patterns, packet types, error types, events, and other criteria. Additionally, it provides enhanced visibility into the USB 3.0 bus, detecting low-level bus events including link training, LFPS polling, training sequences, and provides a view into the LTSSM which tracks upstream and downstream link state transitions.

Descriptor Decoding on the Beagle USB v2 5000 Protocol Analyzer

The Beagle USB v2 5000 analyzer captures early, low-level bus events including the enumeration process. Combined with the Data Center Software, users can see all of the enumeration information in decoded format. For instance, take a look at the information below of the captured from the Beagle USB 5000 v2 analyzer and displayed by the Data Center Software from a USB computer mouse. The Data Center software logs information on all four of the main USB descriptor data packets as seen in the images below.

Device Descriptor in the Data Center Software Device Descriptor in the Data Center Software
Configuration Descriptor in the Data Center Software Configuration Descriptor in the Data Center Software
Interface Descriptor in the Data Center Software Interface Descriptor in the Data Center Software
Endpoint Descriptor in the Data Center Software Endpoint Descriptor in the Data Center Software

Understanding the enumeration process is one of the single most important aspects of the USB protocol. It is also one of the most challenging aspects of implementing a USB device and can quickly cause problems in the development cycle.  The proper enumeration of USB devices is an absolute must when it comes to USB and having the right tools to debug is essential.

For more information on how Total Phase interfaces with the USB bus, check out our USB product page. To see one of our USB analyzers in action, check out this video of our Beagle USB 5000 v2 Protocol Analyzer sniffing a USB 3.0 flash memory device.