Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Which Version of USB is Right for Your Application?: Part 1


The Universal Serial Bus (USB) peripheral interface has become ubiquitous across all personal computing platforms as well as many industrial and infrastructure platforms. However, at the same time, the version of the specification that is right for a given application—USB 1.0, USB 1.1, USB 2.0, On-the-Go (OTG), WirelessUSB (WUSB)—can lead to confusion.

The release of the USB 1.1 specification, combined with the native operating system support offered by Microsoft, enabled the rapid adoption of USB hosts in the PC. It also drove the conversion of many peripheral devices from legacy interfaces such as serial (RS-232), PS-2 (mice and keyboards), and parallel ports (Centronix and IEEE-1284 for printers) to this common interface standard. With the release of the USB 2.0 specification enabling a higher speed connection, an even greater explosion in the number of USB peripherals available greatly enhanced the end-user experience. Parts I and 2 of this article will look at the evolution of the USB standard, and Part 3 and 4 will address common applications and determine which flavor of USB would be best for a given application.

Why did we need something called Universal Serial Bus?
To adequately understand why USB has become the universal interface that we all have come to appreciate, we need to reflect back to the early days of the personal computer (PC), in the 1980s! For those of us old enough to remember the original PC and the DOS operating system, we remember non-graphical user interfaces (GUI) and no World Wide Web!

This system architecture and usage model supported very limited "peripherals." Most computers did not include a hard disk drive inside the box, let alone adding external storage. External network connections—to what network? The only required human interface device was a keyboard, which had its own specific connection port. The only other common peripheral in this time frame is the printer which typically used one of the various flavors of the parallel port for connection.

The introduction of the Windows operating system's GUI created the need for an alternative human input device, as the Apple Macintosh operating systems already had done. The most common pointing device used for this application is the mouse. This new connection, along with the user's desire to connect to the network, led to the adoption of an additional port in the PC. This port is commonly called the serial port or COM port. Over time, most PCs adopted specialized ports for the keyboard and mouse, called P/S-2 ports.

There are three drawbacks to these common external peripheral ports—parallel, serial, or P/S-2. Figure 1.1 (PS/2and COM) and Figure 2.1 (Printer) shows what these ports typically looked like on the back of a system box.


Figure 1.1: Back of a system box with PS/2 and COM




Figure 2.1: Back of a system box with Printer.



First, they do not allow for port expansion. This limits the number of peripherals that can connect to a PC. To enable additional connection points with these ports requires the end-user to 1) purchase an add-in card with the port(s) of choice, 2) open the system, 3) insert the add-in card, 4) close the system, and 5) re-configure the system to account for the ports added to insure no conflicts.

The second drawback is the limited performance of each of these ports. Table 1.1 summarizes the capabilities of each of these ports.


Table 1.1: Summary of capabilities for a variety of ports

(Click to Enlarge Image)


The third main concern is related to the lack of a standard connection method. Given that each peripheral maker had to decide which port to use, it was also essential to provide required drivers to enable their hardware on the PC system, another headache for the end user.

The Birth of USB!
Fast-forward to the early-to-mid 1990s. More and more users wanted to connect peripherals to their PCs. The various ports to choose from were starting to present the user with some of the problems discussed above.

Additionally, the simple variety of the connections was causing problems for the average user. Most did not know which port to use, nor did they understand the limitations that the port presented. This inspired a group of industry leaders, led by Intel, to get together to define a new universal PC peripheral connection that could replace all of the legacy connection choices as well as address the shortcomings.

They defined a simple four-wire interface with the primary purpose of enabling ease-of-use for PC users. It defined a point-to-point, host-target architecture. With the inclusion of a USB hub device in the specification, this allowed for bus expansion and the connection of additional USB target devices. The intent was to enable an easier method for connecting peripheral devices to the PC, and to expand the number of peripherals supported without requiring the user to figure out which connector to use.

Furthermore, by defining a host-target architecture, the cost of implementation for the target could be lower as most of the "brains" would be contained in the host—typically in a PC and using the CPU for control.

What exactly is this USB?
As indicated above, the USB is a host-centric bus. In other words, the host must initiate all transfers, both outbound and inbound. The specification defines three basic types of devices: host controllers, hubs, and functions (peripherals or targets are also used interchangeably with the word function). Each of which is described in more detail below.

In addition to these three basic types of devices, there are two additional types of devices defined. A compound device is a device that includes a hub and an "integrated" peripheral. A composite device is a device that incorporates more than one type of peripheral within the same unit.

The physical interconnect is a tiered-star topology (see Figure 3.1) with a hub at the center of each star. Each wire segment is a point-to-point connection between the host and a hub or function, or a hub connected to another hub or function. Due to timing constraints allowed for hub and cable propagation times, the maximum number of tiers allowed is seven (including the root tier). Note that in seven tiers a maximum of five non-root hubs can be supported in a communication path between the host and any device.

A compound device occupies two tiers; therefore, it cannot be enabled if attached at tier level seven. Only functions can be enabled in tier seven. The addressing scheme used for devices in a USB system allows for up to 127 devices to be connected to a single host. These 127 devices can be any combination of hubs or peripherals. A compound or composite device will account for two or more of these 127 devices.


Figure 3.1: Physical interconnect tiered-star topology

(Click to Enlarge Image)


What is a Host Controller?
The specification was written so there is only one host in any USB system. The USB specification was not intended as a networking architecture, it was written for easy connection of peripherals to PCs. The host may be implemented in a combination of hardware, firmware, or software. Most typical USB host implementations in the computer today are part of what is known as the core logic chipset.

This host controller device uses the PC CPU for its computing power, the system memory for data storage and movement, and the operating system for its total implementation. All hosts must have a root hub integrated within the system. The host is responsible for the following:


  • Detecting the attachment and removal of USB devices
  • Managing control flow between the host and USB devices
  • Managing data flow between the host and USB devices
  • Collecting status and activity statistics
  • Providing power to attached USB devices
  • USB System Software
  • Manages five areas of interactions between host & devices
    • Device enumeration and configuration
    • Isochronous data transfers
    • Asynchronous data transfers
    • Power management
    • Device and bus management information

Most operating systems now also include a series of "class drivers" to facilitate peripheral connectivity. Class drivers enable peripheral vendors to ship products that will have native support in the operating system software, thereby saving the cost of developing a driver, maintaining the driver for new host systems, and shipping a "storage" device with the peripheral for distributing the driver.

Some commonly used class drivers supported by most operating systems include audio class, human interface device (HID) class, imaging class, mass storage class, printer class, and video class. Many vendors today take advantage of these class drivers for their functionality, but they also choose to include a custom driver or application software for extended functionality beyond that defined in the class driver specification.

What is a Hub?
The simplest way to think of a USB hub is as a splitter and repeater rolled into a single device. Hubs provide the electrical interface between USB devices and the host. Hubs are directly responsible for supporting many of the attributes that make USB user friendly and hide its complexity from the user. The hub provides additional connection points (splitter) beyond those provided by a host implementation and re-broadcasts (repeater) all traffic it sees on its upstream-facing port (towards the host) on its downstream-facing (towards the targets) ports.

Hubs are responsible for detecting connection and disconnection events on their downstream ports and reporting this information to the host. A hub must be capable of supporting any speed or type of USB peripheral (see more on this topic below) that is connected on the downstream ports. Hubs must be able to detect and recover from any bus fault due to connected target error conditions.

In addition, hubs are responsible for managing the power for their downstream ports and reporting any power issues to the host for user notification. The specification defines two different power classes for hubs, bus-powered and self-powered.

A bus-powered hub draws all of its power from the upstream facing port. It may only draw up to 100 mA from the upstream connection upon power-up and 500 mA after final configuration. Fully-configured power is split between the hub, any non-removable functions (compound device) and the external ports. A bus-powered hub is required to provide 100 mA to each of the downstream ports. This limits the number of exposed (end-user accessible) downstream ports on a bus-powered hub to four.

Since there is 100 mA/port and four ports, this is 400 mA required for downstream connections. A fifth downstream port would also require 100 mA to be supplied and these would leave 0mA for the hub itself. A bus-powered hub can have four exposed downstream ports and one or more non-exposed downstream ports, assuming that the hub itself and all functions connected to non-exposed ports consume less than 100 mA total.

A self-powered hub draws its primary power from a local supply such as a wall transformer or other local power supply. The power does NOT come from the upstream connection. A self-powered hub may draw up to 100 mA from its upstream facing port to allow the interface to function when the remainder of the hub is powered down. A self-powered hub is required to supply 500 mA to each downstream port.

While there is no limit in the specification as to the number of downstream ports a self-powered hub may provide, in practical use this is usually limited to seven or less for power purposes. A seven-port hub must have greater than 3.5 A (seven ports at 500 mA/port) of power available to function.

What is a Peripheral?
A USB peripheral is where most of us have experienced USB. Common USB peripherals available today include keyboards, mice, printers, flash-memory sticks, external drives, portable audio players, and digital still cameras (DSC). In terms of the specification, a peripheral is a logical or physical entity that performs a specific function.

At the lowest level, peripheral may refer to a single hardware component, such as a flash-memory device. At a higher level, it may refer to a collection of hardware components that perform a particular function, such as a human interface device that includes a keyboard, a biometric finger-pint reader and a scroll device.

The specification defines four types of data transfers that peripherals can support. Control transfers are used to provide the host with information concerning the type and functionality of the attached device. All devices must support control transfers. The other three types of transfers—interrupt, bulk, or isochronous—are specific to data manipulation of the application.

  • Interrupt transfers are used when a peripheral wants to be "polled" by the host periodically to see if it has data to send to the host. Keyboards, mice, and joysticks are examples of devices that typically use interrupt transfers.
  • Bulk transfers are used to move data between the host system and the peripheral when data integrity is more critical than data latency, and they also include error checking and retries if errors are detected. Printers, scanners, and storage devices are examples of devices that depend primarily on bulk transfers.
  • Isochronous transfers are used for moving "real-time" data. In these transfers, the streaming of the data is more critical than the accuracy of the data. There is no error-checking or retries associated with isochronous transfers. Web-cams, speakers and microphones are examples of devices that utilize isochronous transfers.

Just like with hubs, the specification also defines two general power classes for peripherals, bus-powered and self-powered. Bus-powered peripherals are further separated into low-power bus-powered functions and high-power bus-powered functions. In either case, all power for the device is derived from the upstream connection.

A low-power bus-powered device may draw up to 100 mA at all times; while high-power bus-powered functions can draw up to 100 mA prior to configuration and up to the specification max of 500mA during operation.

Self-powered functions have the same restrictions as self-powered hubs as far as what they may draw from the upstream connection. They can draw up to 100mA to allow the USB interface to function when the remainder of the function is powered down. All other power must be supplied from an external source. Additionally, peripheral devices must support a low-power suspend state that minimizes the current draw to less than 500 μA, which should be enough to enable the computer to wake the device from suspend.

The more recent proliferation of USB-enabled battery powered devices—primarily portable media players—has introduced a new challenge to USB power management. This is especially true if these devices are using the USB connection for battery-charging. A battery-powered device must follow the same rules as standard peripherals.

How they report themselves will determine how much current they can draw from the upstream connection for charging, including the 'suspend state' requirement. This challenge is even greater for devices that have dead batteries that typically need high currents to start the initial charge.

USB 2.0 is a specification NOT a speed
Now that you have some of the history and background on the evolution of the USB specification, let's look at where we are today. The terms USB 1.1, USB 2.0, USB-OTG, WUSB, and OTG are all in common usage today. In many cases they have created confusion among engineers and end-users.

The original USB 1.0 specification was released in January 1996. It defined two speeds for devices, low-speed (LS) at 1.5 megabits per second (Mbps) and full-speed (FS) at 12 Mbps. The specification was revised in July 1998 and released as USB 1.1 with major clarifications/updates. In April 2000, the specification went under a major revision and was released as USB 2.0. This version is a current revision of the specification and it fully superseded USB 1.1.

The beauty of USB 2.0 is that it maintained full backwards compatibility to USB 1.1 devices. However, it added a much needed third speed node, high-speed (480 Mbps), along with keeping both low-speed and full-speed support. In July 2003, the USB OTG addendum was released defining a new class of devices aimed at portable, battery-powered devices. Finally, in May 2005, the Wireless USB specification was released.

The USB Implementers Forum (USB-IF) maintains a Certified Logo License Program to help insure a great end-user experience. To earn the right to use the certified logo, a device must go through a USB-IF maintained certification program that includes both specification compatibility testing and interoperability testing. For standard USB devices there are two certified logos. The first (Figure 4.1) is used for devices that support either low-speed or full-speed as their maximum data transfer speed. The second (Figure 5.1) is used for devices that support high-speed as their maximum data transfer speed.


Figure 4.1: Certified Logo for devices that support either low-speed or full-speed as their maximum data transfer speed devices

(Click to Enlarge Image)


Figure 5.1: Certified Logo for devices that support high-speed as their maximum data transfer speed

(Click to Enlarge Image)


USB OTG is an addendum to the USB 2.0 Specification that defines a new class of devices. This class of devices is intended to extend the functionality of a peripheral product to include limited host capabilities. As the name implies, the original target of the specification was portable devices with which end-users may have wanted to share data when a computer was not available. Usage examples include sharing contact information between two PDAs or cell phones, sharing pictures from one DSC or camera phone with another, or printing directly from a DSC or PDA.

Like standard USB, OTG is a point-to-point, host-centric bus and is not intended as a peer-to-peer networking connection. OTG Products must act as a standard peripheral when connected to standard USB host such as a PC. The OTG addendum mainly addresses how a device must act when it is acting as the host. Just like a standard USB host port (or downstream-facing hub port), an OTG host must supply power.

However, the required supply current is limited to 8 mA. Unlike a standard USB host in a PC, an OTG device may not have a simple way to add drivers for "unrecognized" devices. Therefore, an OTG device must supply what is called a Targeted Peripheral List. This allows the device manufacturer to specify exactly what devices they will support. The specification also requires some type of messaging display to enable communicating to the end-user that an unsupported device has been plugged in and that it will not work.

This messaging can be as simple as an LED or as complex as a text display. In addition, two new protocols were defined as part of the OTG addendum. Host Negotiation Protocol (HNP) defines a method for dynamic switching between host and device roles. Session Request Protocol (SRP) enables a method for bus power to be turned off/on at the discretion of the "host" device.

Like standard USB, the USB-IF also maintains the Certified Logo License Program for OTG devices. Figure 6.1 is used for OTG devices that support either low-speed or full-speed as their maximum data transfer speed, while Figure 7.1 is used for devices that support high-speed OTG connections.


Figure 6.1 Certified Logo License Program for OTG devices

(Click to Enlarge Image)



Figure 7.1: Certified Logo License Program for high-speed devices

(Click to Enlarge Image)


Certified WUSB is the latest extension to USB specification. It defines a wireless interface that combines the speed and security of wired USB technology with the ease-of-use for wireless technology. Certified WUSB will support robust high-speed wireless connectivity by utilizing the common WiMedia MB-OFDM ultra-wideband (UWB) radio platform as developed by the WiMedia Alliance.

There have been WUSB devices available for the last few years that used a proprietary low-bandwidth connection to primarily enable HID devices such as keyboards and mice. These connections are not the same as the Certified WUSB specification developed and promoted by the USB-IF. In addition, there has been recent press activity on a competing UWB technology being promoted as cable-free USB.

Again, this is not the same as Certified WUSB and uses a competing radio technology. The two implementations will not be interoperable. UWB technology offers a solution for high bandwidth, low cost, low power consumption, and physical size requirements. The benefits of Certified WUSB include:

  • Speed:
    • Up to 480Mbps at 3m
    • 110 Mbps at 10m
  • Power Management:
    • Sleep, listen, wake and conserve modes enable users to use power only when a connection is required.
  • Security:
    • Optimum data security through built-in protocols and authentication procedures.
    • Encrypts data during transmission
  • Ease of Use:
    • Same ease of install and set-up as wired USB with the benefit if no cables.
  • Backward Compatibility:
    • Interoperability with all legacy wired USB devices.

Again, the USB-IF maintains a Certified Logo License Program for Certified WUSB products to enable an end user to identify products that are certified to be interoperable and compatible with each other. Figure 8.1 shows the WUSB logo.


Figure 8.1: WUSB logo

(Click to Enlarge Image)


Which USB is right for you?
Thus far, this article reviewed a brief history of PC peripherals, the need for a common interface, and the evolution of the USB specification. Then looked at the USB specification to understand how it impacts the end-user experience. Last, it reviewed the history of the specification and reviewed the different flavors of USB that are in common use today. Part 2 will discuss common applications and determine which flavor of USB is best for each.

(You can go to Part 2 by clicking here.)

About the Author
Dan Harmon has held the position of Product Line Marketing Manager for Catalog Interface Connectivity Products at Texas Instruments for the last six years. During his 20-year career at TI, Dan engineered night-vision FLIR systems, and was a camera-design engineer on CCD Imaging Products before becoming the CCD Product Marketing Engineer. He earned a BSEE from the University of Dayton and a MSEE from the University of Texas in Arlington. You can reach Dan at [email protected].


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.