EmbLogic's Blog

Article:Description of USB Device Enumeration

Introduction
USB Enumeration is the process of detecting, identifying and loading drivers for a USB device.This involves a mixture of hardware techniques for detecting something is present and software to identify what has been connected.
The purpose of this article is to provide an overview of the mechanics of the process
Detecting a Device has been Connected

A USB interface consists of 4 wires. Power, Ground, Data Plus (USBDP) and Data Minus (USBDM). A USB host port with no devices connected uses 15kohm resistors to connect both USB DP and USB DM to GND. When a USB device (sometimes referred to as a slave) is plugged into a USB host there is a change on these USB data lines. It is this change that the USB host uses to detect a device has been connected.This change is also used to identify the speed of device attached.

Determining the Device Speed
A low speed USB device (1.5Mbps) uses a 1k5 pull-up resistor to VCC on the USB DM signal line.
A full speed USB device (12Mbps) uses a 1k5 pull-up resistor to VCC on the USB DP signal line.
A high speed USB device (480Mbps) will initially appear as a full speed device to the host. The first thing the USB host does is to attempt to send /receive packets at high speed to the USB device. This is known as J and K chirp and if communication is successful it will be assumed that the USB device is a high speed device. If this initial communication fails then the USB host assumes that the device is a full speed device. This means a high speed device has a 1k5 pull up resistor on USB DP that can be switched in / out of circuit

Determining What Device is Attached (Device Descriptor)
Devices are identified by descriptors. Once the USB host has established a USB device is connected, and at what speed it should communicate,then the host will reset the USB device and attempt to read the descriptors to identify the USB device using a default address.
This basically follows a question and answer process. The USB host will send a Get_Device_Descriptor command and then receive a packet of bytes with the descriptor length and the actual descriptor. At the completion of this stage the device is reset and given a unique address before getting the configuration and interface descriptors.

bLength.
All USB devices have descriptors and the first key one is the Device Descriptor. The length is 18 bytes
and it is bDdescriptorType is type 1.

bcdUSB.
This is used to identify the device as a USB 1.0, USB 1.1 or USB 2.0 compliant device

bDeviceClass, bDeviceSubClass and bProtocol
The bDeviceClass of device defines the device type e.g. a USB Mouse is a Human Interface Device (HID)
class device. This is given a hex value of 0×03.More complex devices such as Communication Device Class (CDC) may also use a sub class to break down the device type into a smaller group.

bMaxPacketSize
This defines the maximum number of bytes in a packet from an endpoint

idVendor and idProduct
The idVendor (VID) is assigned to a company by the USB Implementers Forum. An idProduct (PID) is used with this value to help associate a device with a manufacturer and product. It is also used to help link the hardware with a specific driver.
iManufacturer, iProduct and iSerialNumber
These values are indexes to the Manufacturer string, the Product name string, and the Serial Number strings. These descriptors help make the identifiers more human readable and can be of variable length.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>