HOME PAGE
Home  *  Aircraft/Vehicular  *   Embedded Linux   *   Security & Safety  *   Instrumentation & Test   *   Semiconductor Manufacturing  *   RFID Applications   *   Alternative Energy/Conservation   * Development Tools  *   Contact Us

 

USB Basics

In the early days of personal computers, there were several different electrical interfaces to different kinds of input and output devices. These included serial ports for modems, parallel ports for printers, “PS/2” connectors for keyboards and mice, SCSI ports for scanners and external drives, and 15-pin analog connectors for joysticks.  Adding to the confusion, many of these peripherals came in different versions that connected differently (printers could be serial or parallel, mice could be serial or  PS/2, etc.)  Another drawback to the arrangement was that most computers had a fixed number of each type of connector.  For example, if you needed more than two serial ports, you would have to buy an add-on card.  If you needed more than four serial ports, you would probably need to install install device driver software, which often didn't work well with all applications and operating systems.  Worse yet, many of these devices (such as keyboards and PS/2 mice) required you to power the computer down before attaching or detaching them. There was an urgent need for something that was more standard, and simpler to use for the consumer.

In the mid-1990's, a consortium of technology companies developed a new standard called the Universal Serial Bus, or USB for short.  The group included such personal-computer giants as Intel, Compaq, IBM, Microsoft, and NEC, as well as Digital and Northern Telecom.  Considering its sponsors, it was probably inevitable that USB came to be a standard on x86-based Windows PC's.  USB has been standard on virtually every PC sold since the days of Windows 98.  Apple came along later, offering USB as standard on its iMac since 2003.

USB had several advantages over earlier types of computer interfaces:

* Hot-swappable – USB devices can be plugged in and removed without having to turn off the computer.

* Compact size – the compact size of the standard “Type A” USB socket allows it fit easily on the edge of notebook computers, personal digital assistants, and other portable devices.  Smaller versions (Type B full size and mini) are small enough to use on cell phones, MP3 players and digital cameras.

* Multiple devices – the USB interface supports up to 127 devices.  Most modern PC's come standard with at least four USB ports. Inexpensive hub devices are available which can be plugged into any of the original ports to expand it to four or more ports.

* Speed – The original version (1.0) of the USB interface had a maximum speed of 12 megabits per second.  But because this bandwidth is shared by all the devices on the bus, actual speed could be much slower, giving rise to the nickname “Universally Slow Bus.”  The newer version (2.0) supports 480 megabits per second, and has eliminated many of the complaints about speed.

* Backward compatibility – Early USB devices (version 1.0 and 1.1) can be  plugged into a USB 2.0 port, which connects them on a slow-speed sub channel.  Other devices can still run in high speed.

* Power – the USB interface supplies a DC voltage (nominally 5 volts) which can be used to supply power to USB-connected devices.  This is a great convenience for low-power devices such as keyboards and mice.  But there is a limit.  The bus can supply no more than half an ampere of current, which means total power of all devices on the bus cannot exceed 2.5 watts.  Devices that require more than this must have their own sources of power.

* Self-identifying – The USB standard includes a way for USB devices to identify themselves to the host computer so that it can automatically load the appropriate device driver software.

* Physically robust – USB connectors are polarized (they can't be inserted incorrectly) and difficult to break, compared to connectors on older interfaces that often had bendable pins.  (This is good, because a lot of people – myself included – are always trying to insert the connector upside-down.)

Design Philosophy

At this point it may be helpful to explain the difference between a serial interface (such as the familiar “RS232” 9-pin connector on the back of a PC) and a parallel interface (most typically the 25-pin connection to a printer.)  As its name states, the USB interface transfers data in a serial fashion.  This means there is a single electrical circuit (in the case of USB there are two circuits, one for each direction of data flow) which allows only one bit of data to be transmitted at a time.  In contrast, a parallel-type interface has multiple connections, and may transmit and/or receive multiple data streams at one time.

To the average person, the choice of a serial interface may be puzzling. It seems that a parallel interface should be faster, since the data stream is more than one bit wide – often 8 bits, 16 bits, or more are sent simultaneously.  Yet technical standards appear to be evolving toward serial technologies.  For example, the familiar IDE interface (which is parallel) for disk drives is being replaced by the Serial ATA standard.   One of the reasons for this is that the data rate (the number of bits that can be transmitted per second) can be much higher for serial connections.  Some of the reasons for this include:

* Because there are fewer wires, there is more space for better isolation of the channel (shielding, physical separation from other wires), which improves the quality of the circuit. * Also because there are fewer channels, there is less of a problem with crosstalk (electrical noise caused by multiple wires running close together) between them.  This makes the data transmission more reliable. * With multiple channels of data, there is the problem of keeping them synchronized; that is, all eight or sixteen bits must be transferred at exactly the same time.  This is is not a problem with serial data.

Ramifications for Developers

In college, I had an engineering professor who used to talk about “conservation of misery”, meaning if you avoided a problem in one area it would often come back to bite you in some other way.  This is definitely true in the case of USB. The ease that this interface provides for the consumer means extra work for software developers.  In the early days of the PC, it was a relatively simple operation in software to “open” an RS232-type serial data channel.  (Back in those days, this kind of “serial” interfaces used to be implemented on a huge 25-pin connector, which was odd considering the few circuits that were actually used.)  All the programmer needed to do was to specify which physical connection is to be used, and set the data rate (how fast the bits would go) and a few other data transmission options.

The connection to the USB port is much more complex.  One reason is because the PC must recognize the act of plugging in the device.  It must be able to read the device type, and then find and the correct device-driver software (if it is available)  automatically.  This means there is a large body of code, which is in every PC and every USB peripheral device, which deals with initializing, maintaining, and terminating the connection.  The messages that USB devices send each other – as well as all the other details, physical as well as electrical – are defined in a document that was written by engineers from the USB consortium companies.  An entire chapter of this document is devoted to this functionality.

This so-called “Chapter 9 Support” is available in all the main operating systems that run on a personal computer, including Windows, Apple and Linux.  For Windows, for example, the software developer needs to get the Windows “Device Driver Kit” from Microsoft.  Most computer peripherals these days contain an embedded microprocessor chip, making them small computers in their own right.  Many of these embedded-system-type processors come with built-in support for the USB interface.  For example, there are versions of the popular “PIC” processor from Microchip Technology, that give the USB developer a head-start.  The processor has several input/output pins which are designed to provide the standard signals needed by the USB interface. There is also special software built into the processor that do some of the more basic USB tasks.  But there's no way these small processors can do all the work for us, because there are great differences between different kinds of peripheral (for example, a mouse behaves quite differently than a USB-based “thumb” drive.)  This means there is additional software which the developer must provide.  Luckily, the chip manufacturers (such as Microchip) will usually provide example code that developers can use, modify, and incorporate in their own products.

The USB specification handles many types of devices – miniature “hard drives” for data storage, media players for audio and video, computer input devices such as keyboards and mice, even modems to connect to the Internet.  Most of the existing types of devices are mentioned in the USB specification.  And every different type of device – for example, every different model of mouse or trackball manufactured by every different company – needs to be registered with the USB consortium so it can be assigned its own unique ID number.  This is very important, because this is how computers tell one device from another.  Again this is a case of convenience for the customer making things less convenient for the developer.

Though USB is becoming increasingly standard, it does have competition in the computer world.  At the same time USB was first introduced, Apple Computer was leading the development of a communications interface it called “FireWire” (also known by its generic name, IEEE 1394.)  This was an interface designed for high-speed data transfer.  It has been popular for connecting computers to external data storage devices and to digital video cameras.  However, because the new faster 2.0 version of USB was competitive in speed, and USB devices are so widely available, FireWire is losing ground to USB.  Even Apple finally succumbed to the trend, and started including USB interfaces on its computers.

One of the few interfaces that is resisting the USB trend is Ethernet, the familiar phone-like connection used in networking.   Although, for example, many cable modems have a USB interface, many users still prefer the Ethernet interface.  This makes senses, because Ethernet is better for persistent connections; it is not a “jack of all trades” like USB. In network-type applications, Ethernet is more reliable and performs better than USB.   Also, Ethernet cables can be longer, about twenty times longer than the sixteen-foot limit for a USB connection.  But the USB interface is definitely the more flexible and less expensive of the two.

Although it has its drawbacks, USB has proven to be a great leap forward in the world of computer peripherals.  It has greatly simplified the job of connecting electronic devices together.  It has supplanted many of the other incompatible communications technologies of yesterday, such as serial, parallel, and SCSI.    This technology has become a must-have for consumers, manufacturers, and electronics designers alike.

References:

USB origins - http://computing-dictionary.thefreedictionary.com/USB

“Connectivity options in a Networked World”, Ron Eggers and Wendell Benedetti.

http://www.everythingusb.com/usb2/faq.htm

USB & Apple – http://www.macobserver.com/article/2005/02/25.4.shtml

USB basics - http://en.wikipedia.org/wiki/USB

Limitations of USB -http:// www.datapro.net/techinfo/usb_info.html

The USB cable - http://www.interfacebus.com/Design_Connector_USB.html

Design issues - http://en.wikipedia.org/wiki/Serial_communications

On Fire Wire - Go External: FireWire 800, Patrick Schmid, Rainer Pabst, April 2, 2004 on http://www.tomshardware.com/2004/04/02/go_external/index.html

IEEE 1394 - The Multimedia Bus of The Future, www.cablelabs.com

http://www.embedded.com/1999/9906/9906feat2.htm Ethernet versus USB - compnetworking.about.com/od/broadband/f/modeminterface.htm

Copyright 2006 Nakota Software Web design and photography - Dawn O'Doul.com (Lunar Imaging) click here