Powered By

Free XML Skins for Blogger

Powered by Blogger

Tuesday, June 3, 2008

USB


Short for Universal Serial Bus, standard that supports an external busdata transfer rates of 12 Mbps. A single USB port can be used to connect up to 127 peripheral devices, such as mice, modems, and keyboards. USB also supports Plug-and-Play installation and hot plugging.

Starting in 1996, a few computer manufacturers started including USB support in their new machines. It wasn't until the release of the best-selling iMac in 1998 that USB became widespread. It is expected to completely replace serial and parallel ports.

USB was designed to allow many peripherals to be connected using a single standardized interface socket and to improve the plug-and-play capabilities by allowing devices to be connected and disconnected without rebooting the computer (hot swapping). Other convenient features include providing power to low-consumption devices without the need for an external power supply and allowing many devices to be used without requiring manufacturer specific, individual device drivers to be installed.

USB is intended to help retire all legacy varieties of serial and parallel ports. USB can connect computer peripherals such as mice, keyboards, PDAs, gamepads and joysticks, scanners, digital cameras, printers, personal media players, and flash drives. For many of those devices USB has become the standard connection method. USB was originally designed for personal computers, but it has become commonplace on other devices such as PDAs and video game consoles. As of 2008, there are about 2 billion USB devices in the world.

The design of USB is standardized by the USB Implementers Forum (USB-IF), an industry standards body incorporating leading companies from the computer and electronics industries. Notable members have included Agere (now merged with LSI Corporation), Apple Inc., Hewlett-Packard, Intel, NEC, and Microsoft.


Host controllers

The computer hardware that contains the host controller and the root hub has an interface geared toward the programmer which is called Host Controller Device (HCD) and is defined by the hardware implementer.

In the version 1.x age, there were two competing HCD implementations, Open Host Controller Interface (OHCI) and Universal Host Controller Interface (UHCI). OHCI was developed by Compaq, Microsoft and National Semiconductor; UHCI was by Intel.

A typical USB connector.
A typical USB connector.

VIA Technologies licensed the UHCI standard from Intel; all other chipset implementers use OHCI. UHCI is more software-driven, making UHCI slightly more processor-intensive than OHCI but cheaper to implement. The dueling implementations forced operating system vendors and hardware vendors to develop and test on both implementations which increased cost.

HCD standards are out of the USB specification's scope, and the USB specification does not specify any HCD interfaces. In other words, USB defines the format of data transfer through the port, but not the system by which the USB hardware communicates with the computer it sits in.

During the design phase of USB 2.0 the USB-IF insisted on only one implementation. The USB 2.0 HCD implementation is called the Enhanced Host Controller Interface (EHCI). Only EHCI can support hi-speed transfers. Most of PCI-based EHCI controllers contain other HCD implementations called 'companion host controller' to support Full Speed and Low Speed devices. The virtual HCD on Intel and VIA EHCI controllers are UHCI. All other vendors use virtual OHCI controllers.


Device classes

Devices that attach to the bus can be full-custom devices requiring a full-custom device driver to be used, or may belong to a device class. These classes define an expected behavior in terms of device and interface descriptors so that the same device driver may be used for any device that claims to be a member of a certain class. An operating system is supposed to implement all device classes so as to provide generic drivers for any USB device. Device classes are decided upon by the Device Working Group of the USB Implementers Forum.

Device classes include:

Class Usage Description Examples
00h Device Unspecifiedclass 0 (Device class is unspecified. Interface descriptors are used for determining the required drivers.)
01h Interface Audio speaker, microphone, sound card
02h Both Communications and CDC Control ethernet adapter, modem, serial port adapter
03h Interface Human Interface Device (HID) keyboard, mouse, joystick
05h Interface Physical Interface Device (PID) force feedback joystick
06h Interface Image Digital Camera (Most cameras function as Mass Storage for direct access to storage media).
07h Interface Printer laser printer, Inkjet printer
08h Interface Mass Storage USB flash drive, memory card reader, digital audio player
09h Device USB hub full speed hub, hi-speed hub
0Ah Interface CDC-Data (This class is used together with class 02h - Communications and CDC Control.)
0Bh Interface Smart Card USB smart card reader
0Dh Interface Content Security -
0Eh Interface Video webcam
0Fh Interface Personal Healthcare -
DCh Both Diagnostic Device USB compliance testing device
E0h Interface Wireless Controller Wi-Fi adapter, Bluetooth adapter
EFh Both Miscellaneous ActiveSync device
FEh Interface Application Specific IrDA Bridge
FFh Both Vendor Specific (This class code indicates that the device needs vendor specific drivers.)

Note class 0: Use class information in the Interface Descriptors. This base class is defined to be used in Device Descriptors to indicate that class information should be determined from the Interface Descriptors in the device.


USB signalling

USB supports three data rates:

  • A Low Speed (1.1, 2.0) rate of 1.5 Mbit/s (187.5 kB/s) that is mostly used for Human Interface Devices (HID) such as keyboards, mice, and joysticks.
  • A Full Speed (1.1, 2.0) rate of 12 Mbit/s (1.5 MB/s). Full Speed was the fastest rate before the USB 2.0 specification and many devices fall back to Full Speed. Full Speed devices divide the USB bandwidth between them in a first-come first-served basis and it is not uncommon to run out of bandwidth with several isochronous devices. All USB Hubs support Full Speed.
  • A Hi-Speed (2.0) rate of 480 Mbit/s (60 MB/s).

Experimental data rate:

  • A Super-Speed (3.0) rate of 4.8 Gbit/s (600 MB/s). The USB 3.0 specification will be released by Intel and its partners in mid 2008 according to early reports from CNET news. According to Intel, bus speeds will be 10 times faster than USB 2.0 due to the inclusion of a fiber optic link that works with traditional copper connectors. Products using the 3.0 specification are likely to arrive in 2009 or 2010.

USB signals are transmitted on a twisted pair data cable with 90Ω ±15% impedance,[6] labeled D+ and D−. These collectively use half-duplex differential signaling to combat the effects of electromagnetic noise on longer lines. D+ and D− usually operate together; they are not separate simplex connections. Transmitted signal levels are 0.0–0.3 volts for low and 2.8–3.6 volts for high in Full Speed and Low Speed modes, and ±400mV in High Speed (HS) mode. In FS mode the cable wires are not terminated, but the HS mode has termination of 45Ω to ground, or 90Ω differential to match the data cable impedance.

USB uses a special protocol to negotiate the High Speed mode called "chirping". In simplified terms, a device that is HS capable always connects as an FS device first, but after receiving a USB RESET (both D+ and D- are driven LOW by host) it tries to pull the D- line high. If the host (or hub) is also HS capable, it returns alternating signals on D- and D+ lines letting the device know that the tier will operate at High Speed.

Clock tolerance is 480.00 Mbit/s ±500ppm, 12.000 Mbit/s ±2500ppm, 1.50 Mbit/s ±15000ppm.

The USB standard uses the NRZI system to encode data, and uses "bit stuffing" by always injecting one artificial "zero" bit if the stream of data contains six consecutive "ones" before converting the bit stream to NRZI.

Though Hi-Speed devices are commonly referred to as "USB 2.0" and advertised as "up to 480 Mbit/s", not all USB 2.0 devices are Hi-Speed. The USB-IF certifies devices and provides licenses to use special marketing logos for either "Basic-Speed" (low and full) or Hi-Speed after passing a compliance test and paying a licensing fee. All devices are tested according to the latest spec, so recently-compliant Low-Speed devices are also 2.0 devices.

The actual throughput currently (2006) attained with real devices is about two thirds of the maximum theoretical bulk data transfer rate of 53.248 MB/s. Typical hi-speed USB devices operate at lower speeds, often about 3 MB/s overall, sometimes up to 10-20 MB/s

USB cables

Pin Name Cable colour Description
1 VCC Red +5V
2 D− White Data −
3 D+ Green Data +
4 GND Black Ground

The maximum length of a standard USB cable is 5.0 meters (16.4 ft). The primary reason for this limit is the maximum allowed round-trip delay of about 1500 ns. If a USB device does not answer to host commands within the allowed time, the host considers the command to be lost. When USB device response time, delays from using the maximum number of hubs and delays from cables connecting the hubs, host and device are summed, the maximum delay caused by a single cable turns out to be 26 ns. USB 2.0 specification states that the cable delay must be less than 5.2 ns per meter, which means that maximum length USB cable is 5 meters long. However, this is also very close to the maximum possible length when using a standard copper cable.

Miniplug/Microplug
Pin Name Color Description
1 VCC Red +5 V
2 D- White Data -
3 D+ Green Data +
4 ID none permits distinction of

Micro-A- and Micro-B-Plug

Type A: connected to Ground

Type B: not connected

5 GND Black Signal Ground

The data cables are a twisted pair to reduce noise and crosstalk.

Image:USB Twisted Pair.svg

Maximum Useful Signalling Distance

Although a single cable is limited to 5 meters, the USB specification permits up to five USB hubs in a long chain of cables and hubs. Consequently the maximum possible signalling distance is 30 meters, using six 5-meter cables and five hubs. In actual use, the last hub is a more convenient endpoint since some USB devices include built-in cables intended to directly connect to a hub, setting the maximum useful signalling distance at 25 meters.

Because USB is able to provide power for additional devices connected to the bus, a special type of USB extender cable was created which consists of a miniature one-port USB hub molded into one end of a 5 meter cable. These mini-hubs are fully self-contained within the cable, requiring no separate bulky hub device, and are as simple to use as plugging cables together, with each hub drawing power through all the previous single-port hubs in the chain.

The bus power is limited however, so the most practical application is to use four single-port hub extender cables, one plain 5 meter cable, and then a powered multiport hub at the very end to support multiple additional USB devices. This is especially useful where a cool and quiet work area is needed, permitting a keyboard, mouse, flash drive, printer, etc to be used 25 meters from a loud heat-generating computer.

USB compared with FireWire

USB was originally seen as a complement to FireWire (IEEE 1394), which was designed as a high-speed serial bus which could efficiently interconnect peripherals such as hard disks, audio interfaces, and video equipment. USB originally operated at a far lower data rate and used much simpler hardware, and was suitable for small peripherals such as keyboards and mice.

The most significant technical differences between FireWire and USB include the following:

  • USB networks use a tiered-star topology, while FireWire networks use a repeater-based topology.
  • USB uses a "speak-when-spoken-to" protocol; peripherals cannot communicate with the host unless the host specifically requests communication. A FireWire device can communicate with any other node at any time, subject to network conditions.
  • A USB network relies on a single host at the top of the tree to control the network. In a FireWire network, any capable node can control the network.
  • USB runs with a 5v power line, whereas Firewire can supply up to 30v.

These and other differences reflect the differing design goals of the two buses: USB was designed for simplicity and low cost, while FireWire was designed for high performance, particularly in time-sensitive applications such as audio and video. Although similar in theoretical maximum transfer rate, in real-world use, especially for high-bandwidth use such as external hard-drives, FireWire 400 generally, but not always, has a significantly higher throughput than USB 2.0 Hi-Speed. The newer FireWire 800 standard is twice as fast as FireWire 400 and outperforms USB 2.0 Hi-Speed both theoretically and practically. The chipset and drivers used to implement USB and Firewire have a crucial impact on how much of bandwidth prescribed by the specification is achieved in the real world, along with compatibility with peripherals. Audio peripherals in particular are affected by the USB driver implementation.

One reason USB supplanted FireWire, and became far more widespread, is cost; FireWire is more expensive to implement, producing more expensive hardware.

DESCRIPTION OF AN USB
The Universal Serial Bus (USB) specification is a proposed standard recently promulgated by a group of computer companies including Compaq Computer Corporation. Digital Equipment Corporation, IBM, Intel Corporation, Microsoft Corporation and Northern Telecom. Described below are various aspects of the Universal Serial Bus. Further background concerning the Universal Serial Bus may be obtained from the Universal Serial Bus Specification. Revision 1.0. which is hereby incorporated bv reference. The Universal Serial Bus is intended as a bi-directional. isochronous. low-cost. dynamically attachable, serial interface to promote easy PC peripheral expansion and provide fall support for real-time voice. audio, and compressed video data. The Universal Serial Bus provides two-wire point-to-point signaling in which the signals are differentially driven at a bit rate of 12 megabits per second. The Universal Serial Bus includes support for both isochronous and asynchronous messaging at the 12 megabit per second data speed.

The Universal Serial Bus specification defines a Universal Serial Bus system in terms of Universal Serial Bus "interconnects". "devices", and 'hosts" A Universal Serial Bus interconnect defines the manner in which devices are connected to and communicate with the host. including bus topology, data flow models.

scheduling, and interlaver relationships. In any given Universal Serial Bus topology. there is only one host.

Universal Serial Bus devices include hubs and functions. Hubs provide additional attachment points to the Universal Serial Bus and may be integrated with a host, which ordinarily provides only one attachment point for connecting a hub or a function. Functions provide capabilities to the system. such as joystick, keyboard. microphone. and speaker capabilities.

The basic data transfer protocol of the Universal Serial Bus is described as follows, with particular attention to Fig. 1. Fig. lisa diagram of the basic packet transfer 1000 of the Universal Serial Bus. The basic transfer 1000 includes a token packet 1002, a data packet 1004, and a handshake packet 1006. Each packet is preceded by a synchronization field SYNC which is used by input circuitry to align incoming data with the local clock. It is defined to be 8 bits in length and is stripped out bv the connector interface.

Following the SYNC field in each packet is a packet identifier (PID(T) for the token packet. PID(D) for the data packet. PID(H) for the handshake packet, and PID(S) for the start-of-frame packet. which may be considered a type of token packet). The packet identifiers PID(T), PID(D), PID(H) and PID(S) include a 4- bit identification field and a 4-bit check field used to identify the format of the packet and type. There are two types of token 1002 packet ID fields PlD(T). These denote (i) a data transfer from the function to the host: and (ii) a data transfer from the host to the function. In addition to the packet ID. PID(T), the token packet includes an 8-bit address field ADDR and a 3-bit end point field, ENDP. The address field ADDR of the token packet specifies the function that it is to receive or send the data packet. The end-point field ENDP permits addressing of more than one subchannel of an individual function.

Only one type of start-of-frame packet identification field 1008, PID(S), is defined: a start of frame time stamp. The address and endpoint fields of the token packet are replaced in the start of frame packet with a time-stamp field. The time-stamp field for the start of frame packet provides a clock tick which is available to all devices on the bus. The start-of-frame packet is sent by the host every 1 ms 1 0.01%. In addition. for both the token and start-of-frame packets, a 5-bit cyclical redundancy checksum (CRC) field is provided.

The data packet 1004 includes a packet identifier PID(D), a data field DATA. and a 16-bit cyclical redundancy checksum field, CRC 16. Two types of packet IDs for the data field, data 0 and data 1, identify whether the data packet is being sent for the first time or whether being sent as a retry. The data field DATA may vary in length from 0 to N bytes. Failure of the cyclical redundancy checksum on the data field DATA causes the receiver to issue an error ERR handshake.

The handshake packet 1006 includes only a packet identifier PID(ll), of which there are four types.

An acknowledge handshake. ACK. indicates that the receiver will accept the data and that the CRC has succeeded. A negative acknowledge. NACK. indicates that the receiver cannot accept the data or that the source cannot send the data. An ERR field indicates that the receiver will accept the data. but that the CRC has failed. A stall handshake packet, STALL. indicates that the transmission or reception pipe is stalled. A stall handshake is defined only for stream-oriented end-points (as distinguished from message-oriented endpoints. discussed below).

Data flow on the Universal Serial Bus is defined in terms of "pipes." A pipe is a connection between a host and an endpoint. The Universal Serial Bus defines "stream ' and "message" pipes. For a stream pipe. data is delivered in prenegotiated packet sizes. Data flows in at one end of the stream pipe and out the other end in the same order. Stream mode thus includes flow control and employs no defined USB structure. For a message pipe. however, a request is first sent to the device which is followed at some later time by a response from the end-point. Message pipes thus impose a structure on the data flow, which allows commands to be communicated. These commands can include band-width allocation.

The Universal Serial Bus supports isochronous, asynchronous. and asynchronous interactive data flow. For isochronous data. access to USB bandwidth is guaranteed. A constant data rate through the pipe is provided. and in the case of delivery failure due to error, there is no attempt to retry to deliver the data.

Asynchronous interactive data flow provides a guaranteed service rate for the pipe, and the retry of failed transfer attempts. Asynchronous data flow accommodates access to the USB on a band-width available basis and also permits retry of data transfers.

Scheduling of the Universal Serial Bus is defined in terms of "slots", "frames" and "super frames", as illustrated in Fig. 2, which shows an exemplary USB schedule 1100. Frames 1104b and 1104a begin with a start of frame packet, 1 108a and 1108b, respectively. Each frame has a duration of time equal to 1 | N ms.

Each frame, 1iota. 1 104b is subdivided into one or more slots. 1102a. 1102b. for example. Each slot corresponds to some USB transaction, e.g., 1110a. 1110b. 1110c. 1110d. Each slot is large enough to contain the worst case transmission time of the transaction to which it corresponds. and includes the effects of bit-stuffing, propagation delay through cables and hubs. response delays, and clocking differences between the host and the end-point. A super frame 1106 consists of a repeatable sequence of individual frames, and is the largest schedulable portion of time permitted.

The Universal Serial Bus provides both periodic service and aperiodic service. For periodic service corresponding to isochronous data. a fixed period exists between the delivery of start of frame packets to a specific end-point. However, aperiodic service is characterized by a varying period bet veer delivery of start of frame tokens for a given end-point. Periodic service is given a higher priority in scheduling than aperiodic service.

Turning now to Fig. 3, there is illustrated an abstracted block diagram of a Universal Serial Bus device, such as a hub or function. Universal Serial Bus device 1200 includes a device interface 1202 and a class interface 1201. Device interface 1202 includes device information and control block 1206, which is required for the USB device to attach to the USB and is independent of the flinctionalit,,' provided bv the device. The device interface further includes serial bus interface engine 1210. which provide for management of the bus interface. including performing acknowledgments and recognizing packets that are addressed to the USB device. In addition. the interface engine 1210 provides for stripping the SYNC field from incoming packets. The class interface 1204 includes class information and conuol block 1214 which depends upon the functionality of the device (for example, hubs and locators). Class interface 1204 further includes function engine 1216 which relates to the functionality implemented by the device. A USB device further includes logical buffers, such as packet buffer 1208 and elasticity buffer 1212. The packet buffer defines the maximum packet size which the USB device can receive or send. The elasticity buffer relates to how flexible the scheduled generator may be in allocating band-width for the associated end-point and determines the maximum amount of data the device end-point can handle. The various functional blocks of the USB device are not shown connected to one another in Fig. 3 because. as discussed in the USB specification, the relationship between the components may be implementation-dependent. In addition, a Universal Serial Bus device may include storage space, local to the USB device, though addressable by the host; and vendor space, which may be defined by the vendor of the device.

While the Universal Serial Bus is intended to be an industry-wide standard peripheral interface, the Universal Serial Bus Specification does not define the relationship between components in Universal Serial Bus devices. There is therefore a need to provide novel architectures for Universal Serial Bus devices. More particularly, there is a need to define a novel architecture for a powered speaker and/or microphone compatible with the Universal Serial Bus Specification.

In addition, while the USB specification defines signaling whereby a USB device or hub controller may wake the network from a low power mode, the USB specification does not define a mechanism whereby the devices may power themselves down or awaken in response to the signaling. There is therefore a need to provide a USB compatible speaker and/or microphone having power management capabilities.

Moreover. in the case of a USB speaker and/or microphone. random power fluctuations. either at power-up or during normal operation. can feed through the speakers and cause annoying "pops" and "hisses" to be transmitted through the speakers. In the extreme case. these can cause damage to the speaker.

Accordingly, there is a need to provide a USB compatible speaker and/or microphone having click suppression when the USB is unstable or during power-up and power-down.







No comments: