USB is the Upper Sideband level of Single Sideband transmission of AM radio. It's more ore typically used and referred to in comparison to LSB.

The Macintosh computer (and the legacy-free iMac) paved the way for the USB devices of today. However, one of the little ironies is that the Macintosh keyboard was not fully USB compliant until around the middle of 2000.

If you plug in a Macintosh keyboard to a Windows machine, you will blue screen the computer, if you press the power button. This is because the USB implementation on a Macintosh involves dropping the fourth pin low to turn on the machine. This signal, which is out of spec for USB, is not handled by many drivers, including that of Windows 2000 RTM. The low fourth pin tells the Macintosh to come out of sleep mode, or to turn on or off.

I learned this because the keyboard drivers that I worked on were for a fully USB compliant board, as are the million other USB keyboards out there. In the old ADB system, Apple had two pins for this purpose, one for turning on the computer, and one for turning off the computer. We discovered this because someone's Mac turned off, but never back on again with the button on that keyboard (but it worked with other boards; We finally took it apark with a multitester to find out why.) They controlled the technology, and thus did not have any problems getting it to work with what their users expect. Apple's innovation, which they did not adhere to. Finally, the USB committee got the them to fix up their keyboards, and now they do something in software for that key, or so I am told.

Introduction

In many of the more recent computers, little slot-like ports started to come included. Of course, the manual never said anything about the ports, and there were no devices back then with connectors that actually fit those slots. This slot is called a Universal Serial Bus (USB) port. Though this technology is fairly new, more and more manufacturers are beginning to sell USB-compatible peripherals and equipment. Almost 100 per cent of PC shipments are USB compatible, and the base of USB-installed PCs exceeds 500 million.

What the heck is USB?

USB stands for Universal Serial Bus. USB was developed by the computer industry leaders including Microsoft, Compaq, Intel, and NEC to increase the ease-of-use, performance and speed of peripherals by standardizing the way they attach to the PC. It is the easiest way to attach devices to your PC. The aim is on peripherals that connect to the outside of the computer. With USB, users won't have to open up the computer to install new peripherals. USB consists of a host, hub, and function. The host is the exchange point between USB peripherals, which is linked to a host controller, integrated into either the motherboard or PCI USB addon solutions. The hub allows multiple devices connect to the host. There is a USB hub already in USB-compatible compatible computers, that branches out to usually two connectors on the back of the computer. A function is a device that attached to the USB port.

So what? Why should I use USB?

  • Plug and Play(PnP) - USB was designed to meet to Microsoft's Plug-and-Play specification, meaning that devices can be plugged in, installed, and hot-swapped (removed and replaced with another device) without long installation procedures and reboots. That means devices will automatically detected as soon as you plug them in and will install without having to turn off the computer at all. Once you have a USB device's drivers installed, then you can remove it when you don't need it (even when the computer is on) and replace it when you do need it. Even better, you can even take it with you to other computers and connect it without installing permanent software, and after you are done using it, you can remove it without worry. No need for fiddling with the IRQ settings, no need to attach jumper cables. In fact, the best thing about USB is that it only requires one interrupt in the computer for all of the devices.

  • Hot Swapping and Multiple Device Support - Some people like to attach lots of devices to their computers at one time, but normally Windows can't handle it, and often people worry about their computers crashing or failing to work as they attach more and more devices to their PCs. The most often scenario is when a user has no place to plug in the device. USB gets rid of the problem by allowing up to 127 devices to be connected to it simultaneously. In order to connect more devices, however, you have to get a USB hub. Hubs allow multiple devices to plug into a single USB port. The reason you need one is to supply power to the additional ports and control the flow of information between the hub and the USB ports on the back of the computer. Still, with USB hubs you can attach and remove devices without restarting your computer.

  • High Speed and Electricity - USB ports have dual-speed transfer rates, 1.5 Megabits/second and 12 Megabits/second. Regular serial ports have a data transfer speed of only 230 kilobytes/second. It can also provide limited power, maximum 500mA of current, to devices attached to the USB bus. That means that most USB devices will not require a power supply like an AC adapter.

  • One size fits all - There is only one standard connection type for USB. There are two types of connectors, however. The series "A" connector is intended for all USB devices, is a plug for a peripheral and a socket for a PC platform. In most cases a USB cable should be captive (molded in) to it's peripheral. This saves connector cost, eliminates incompatibilities due to power drop in a cable and simplifies the user connection task. There are some cases where a captive cable is prohibitive. A very large heavy device may not be able to tolerate dangling cables that cannot be removed and some devices that are only occasionally connected, but have a useful function when not connected are good examples. The series "B" connector was created for such applications. The 2 connector series are different to prevent connections that violate the USB architecture topology.

What kind of peripherals can connect to USB?

There are thousands of USB peripherals on the market, from USB hubs, to scanners and printers, to digital video cameras. There are even USB modems and ISDN solutions on the market. Today, the USB logo appears all over the place, indicating peripherals that have USB support.

The USB Programming Model

USB, the Universal Serial Bus, is designed to be able to connect practically any kind of peripheral to a PC. This makes it more versatile than any port which came before, but this versatility comes at a cost in terms of the complication of communicating with it. However, in practice much of this complication is hidden from the programmer; rather than needing to program drivers to communicate with the port directly, each operating system which supports USB provides a set of API calls for signalling to and from the port.

In addition to the raw API calls, both Linux and Windows (from Win 95 OSR 2.1 onwards) provide sets of ready-made class drivers, each designed to service a whole class of device. For example: Imaging Devices, such as cameras, scanners and so on; Audio Devices, like microphones and speakers; and Human Interface Devices, which include practically any peripheral which allows the user to interact with the machine: Keyboards, joysticks and mice, obviously, but also any number other devices which feature buttons, sliders or switches of any sort (including many devices which also fall into one or more of the other categories). The HID class is very powerful, but it only supports USB's low-speed data transfer rate of 1.5Mb/s. The faster rate of 12Mb/s is needed by peripherals which transfers significant amounts of audiovisual data, while the extra-fast rate of 480Mb/s introduced with USB 2.0 will allow pretty good quality real-time video to be input or output.

USB uses a multi-layered architecture for drivers, which means that rather than one driver providing for the whole range of communication between PC and peripheral there will typically be two or more drivers (usually at least four for USB) involved in communicating with any one peripheral. This approach is superficially more complex than having a single driver per peripheral, but in fact it makes things simpler for people writing or using drivers because it avoids unnecessary duplication of code; common functionality (such as communicating with the USB hub) can be handled by shared drivers.

Windows divides drivers into two types: Device drivers and bus drivers. Device drivers handle tasks which are specific to a single device or class of devices, while bus drivers handle tasks associated more generally with a bus. An application using a peripheral may communicate with one or more device drivers (in many cases, the two HID drivers plus one of the other class drivers). The device driver(s) in turn sends data down through three separate bus drivers. The first of these is the Hub Driver, which initialises ports and manages interactions between the device drivers and the next bus driver: The USB Bus-Class Driver. This is in charge of enumeration, power and general USB transactions, and intermediates between the Hub Driver and the final bus driver, the Host Controller Driver. This communicates directly with the hardware.

From Windows 98 on, drivers in Windows generally fit into a common framework called the WDM, the Win32 Device Model (before this Windows NT and Windows 95 used quite different driver models, forcing people to write separate drivers in order to support both OSs; Win 98 continues to support older drivers). Communication between drivers in Windows is achieved by means of Interrupt Request Packets (IRPs).

USB supports four distinct types of transfer:


References

  • Jan Axelson, HIDs Up, Embedded Systems Programming October 2000.
  • Jan Axelson, USB Complete (Introduction & Chapter 1 only), http://www.lvr.com
  • Jack G. Ganssle, An Introduction to USB Development Embedded Systems Programming
  • www.usb.org, Approved Class Specification Documents.
  • Microsoft Corporation, WDM:Human Interface Device Class Support, http://www.microsoft.com/hwdev/desinit/WDMINput.HTM
  • Microsoft Corporation, Mike Zerkus, Jonathan Lusher and Jonathan Ward, USB Primer part 1, Circuit Cellar, May 1999
  • Jim Lyle, USB Primer part 2, Circuit Cellar, June 1999

Node your homework

Log in or registerto write something here or to contact authors.