EmbLogic's Blog

Usb devices type ,transfer type in usb and enumeration article

Here We are discuss about the usb devices in this very document

USB is a master-slave protocol where a host controller communicates with client devices. The USB host controller is part of the South Bridge chipset and communicates with
the processor over the PCI bus.

Usb types :-

Usb types Connectors bases :-

There are four basic kinds or sizes related to the USB connectors
1. The older “standard” size, in its USB 1.1/2.0 and USB 3.0 variants eg. usb pendrive
2. The “mini” size (primarily for the B connector ) e.g. Cemra
3. The “micro” size, in its USB 1.1/2.0 and USB 3.0 variants eg. In mobile phone .
4. USB On The Go scheme, in both mini and micro sizes.

Usb types Speed bases :-

1. USB 1.x
USB 1 specified data rates of 1.5 Mbits/s Low-Bandwidth and 12 Mbits/s Full-Bandwidth. It is generally white color.
2. USB 2.0
USB 2.0 is adding higher maximum signaling rate of 480 Mbits Hi-Speed.USB 2.0 connectors are black.

3. USB 3.0
The standard defines a new Super Speed mode with a signaling speed of 5Gbits/s. USB 3.0 port is usually colored blue, and is backwards compatible with USB 2.0

Host Controllers
:-
USB host controllers conform to one of a few standards:

Universal Host Controller Interface (UHCI): The UHCI specification was initiated by Intel, so our
is likely to have this controller if it’s Intel-based.
Open Host Controller Interface (OHCI): The OHCI specification originated from companies such as
Compaq and Microsoft. An OHCI-compatible controller has more intelligence built in to hardware than
UHCI, so an OHCI HCD is relatively simpler than a UHCI HCD.
Enhanced Host Controller Interface (EHCI): This is the host controller that supports high-speed USB
2.0 devices. EHCI controllers usually have either a UHCI or OHCI companion controller to handle slower
devices.
USB OTG controllers: They are getting increasingly popular in embedded microcontrollers. With OTG
support, each communicating end can act as a dual-role device (DRD).

eXtensible Host Controller Interface (xHCI): This is a computer interface specification that defines a register-level description of a Host Controller for Universal Serial bus (USB), which is capable of interfacing to USB 1.x, 2.0, and 3.0 compatible devices. The specification is also referred to as the
USB 3.0 Host Controller

you can check host controllers by the following command
[root@localhost ubh3b]# lspci
00:00.0 Host bridge: Intel Corporation Ivy Bridge DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Ivy Bridge PCI Express Root Port (rev 09)
00:01.1 PCI bridge: Intel Corporation Ivy Bridge PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Device 0166 (rev 09)
00:14.0 USB Controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04)
00:1a.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation Panther Point High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 1 (rev c4)
00:1c.1 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 2 (rev c4)
00:1d.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation Panther Point LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation Panther Point 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation Panther Point SMBus Controller (rev 04)
01:00.0 3D controller: nVidia Corporation Device 1140 (rev a1)
03:00.0 Ethernet controller: Atheros Communications Device 1090 (rev 10)
04:00.0 Network controller: Atheros Communications Inc. AR9485 Wireless Network Adapter (rev 01)

Transfer Types
:-
Data exchange with a USB device can be one of four types:
1. Control transfers :- used to carry configuration and control information
2. Bulk transfers :-that ferry large quantities of time-insensitive data
3. Interrupt transfers:- that exchange small quantities of time-sensitive data
4. Isochronous transfers :- for real-time data at predictable bit rates

A USB storage drive, for example, uses control transfers to issue disk access commands and bulk transfers to exchange data. A keyboard uses interrupt transfers to carry key strokes within predictable delays. A device that
needs to stream audio data in real time uses isochronous transfers.

Addressing
Each addressable unit in a USB device is called an endpoint. The address assigned to an endpoint is called an
endpoint address. Each endpoint address has an associated data transfer type. If an endpoint is responsible for
bulk data transfer, for example, it’s called a bulk endpoint. Endpoint address 0 is used exclusively for device
configuration. A control pipe is attached to this endpoint for device enumeration.
Enumeration
The life of a hotplugged USB device starts with a process called enumeration by which the host learns about the
device’s capabilities and configures it. The hub driver is the component in the Linux-USB subsystem responsible
for enumeration. Let’s look at the sequence of steps that achieve device enumeration when you plug in a USB
pen drive into a host computer:
1. The root hub reports a change in the port’s current due to the device attachment. The hub driver detects
this status change, called a USB_PORT_STAT_C_CONNECTION in Linux-USB terminology, and awakens khubd.
2. Khubd deciphers the identity of the USB port subjected to the status change. In this case, it’s the port
where you plugged in the pen drive.
3. Next, khubd chooses a device address between 1 and 127 and assigns it to the pen drive’s bulk endpoint
using a control URB attached to endpoint 0.
4. Khubd uses the above control URB attached to endpoint 0 to obtain the device descriptor from the pen
drive. It then requests the device’s configuration descriptors and selects a suitable one. In the case of the
pen drive, only a single configuration descriptor is on offer.
5. Khubd requests the USB core to bind a matching client driver to the inserted device.
When enumeration is complete and the device is bound to a driver, khubd invokes the associated client driver’s
probe() method. In this case, khubd calls storage_probe() defined in drivers/usb/storage/usb.c. From this
point on, the mass storage driver is responsible for normal device operation.

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>