Dit is de html-versie van het bestand http://zelweb.zel.kfa-juelich.de/projects/dsp/training/Introduction%20to%20USB.pdf.
G o o g l e maakt automatisch een html-versie van documenten bij het indexeren van het web.
Gebruik de volgende URL om deze pagina aan je Favorieten toe te voegen of ernaar te linken: http://www.google.com/search?q=cache:a8RB8QPShOoJ:zelweb.zel.kfa-juelich.de/projects/dsp/training/Introduction%2520to%2520USB.pdf+introduction+to+usb&hl=nl&ie=UTF-8


Google heeft geen banden met de auteurs van deze pagina en is niet verantwoordelijk voor de inhoud ervan
Deze zoektermen werden geselecteerd: introduction usb 

Page 1
Introduction to USB: (1)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Introduction to USB
Introduction _______________________________________________________________ 2
The modern PC: A short history _______________________________________________ 4
USB: Easy to Use and Low Cost _______________________________________________ 5
USB Terminology _________________________________________________________ 6
USB Topology ____________________________________________________________ 7
PC Host _________________________________________________________________ 9
USB cable________________________________________________________________ 9
Hub Device _____________________________________________________________ 11
I/O Device ______________________________________________________________ 12
Adding USB to an "OLD " PC ______________________________________________ 14
Software model: Essential Theory_____________________________________________ 15

Page 2
Introduction to USB: (2)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Introduction
The personal computer (PC) has been around for a very long time, think that Noah must
have had one on his Ark! The first IBM PC was announced in 1981, and since then we
have all wanted to add hardware to our PCs. The power of the PC has grown; the
number of tasks we want the PC to accomplish has grown; and the number of devices
we want to connect to the PC has grown. But until recently there has been a practical
limit on the number of available ports (ISA or PCI slots, COM ports, LPT ports) to which
we could connect devices.
Enter the Universal Serial Bus, USB. You may have heard USB referred to as the best
thing" to happen to the personal computer for some time. The list of USB features is
impressive:
Hot-pluggable: I/O devices can be added while the PC is running.
Ease of use: I/O device attachment is recognized by the PC and appropriate
Device drivers and configuration is done automatically.
Single connector type: all devices plug into the same socket type.
High performance: up to 480 Mbps transfer rate.
Three speed choices: match I/O device speed to one of the standard speeds for
optimal design.
Up to 126 devices: there is no practical limit to I/O device expandability.
Power supplied by cable: most devices will not need an additional power source.
Power management: devices automatically power down when not in use.
Error detection and recovery: errors are detected and transactions are retried to
ensure that data is delivered reliably.
External to the PC: there is no need to open the PC or design cards that must be
installed in the PC.
Most USB books, including the specification, position USB as a technical wonder, which
it is. But these course and the USB52 kit lack practical, how-to-do examples that include
schematics and code. I designed it to help you add I/O devices to your PC, and I have
tried to make it as much of a Cookbook as I could.
(I use the term PC to refer to Intel-based personal computers running an operating system that supports
USB. I use Windows 98 and Windows 2000 in most of the examples.)

Page 3
Introduction to USB: (3)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
All the examples are fully documented, and a prototype board is available for you to
build upon and expand your ideas and solutions. A variety of vendor solutions are
demonstrated, so that you can choose the solution closest to your application.
¸ Most of the PC host software examples are implemented in Borland or Visual C/C++
and in LabView, so that you can choose the language you are most familiar with.
¸ The microcontroller examples are mainly in MCS Ž51 C code. I choose the MCS 51
architecture because many manufacturers have used it as the basis for their
intelligent USB controllers.
¸ The MCS 51 family has an uncomplicated architecture with few programming tricks,
so the examples should be easy to port to another microcontroller family.
I do not repeat sections from the USB specification, but have included it on the
companion CD-ROM for the interested reader. This book describes how to connect a
PC host to the usual PC-type peripherals (such as scanners, proximity detectors,
keypads, and printers), and also how to connect to everyday items such as lights,
switches, motors, temperature sensors, speakers, video components and telephones.
You will soon discover that adding I/O devices to a modern PC host is both easy and
fun. The range of devices is limited only by your imagination
Focus of this course
This book focuses on I/O device design. It also covers PC host applications and driver
software that will let us view and control our I/O devices. There is a lot of USB software
on a PC Host - we will see that the implementation, of the Win32 Driver Model (WDM) in
the Windows family of operating systems uses a layered approach, so that we can
access USB features and services at a level suitable or our application.
When USB was being developed, a base assumption was the creation of easy, low-cost
I/O devices. The resulting standard is asymmetric with most of the complexity on the PC
host side.The operating system and available host controller silicon take care of this
complexity, so we need deal with only the so-called easy part, the I/O device. Hub
design is also presented, but this is mainly from an I/O device point of view.

Page 4
Introduction to USB: (4)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
The modern PC: A short history
When IBM announced the PC, the company documented the PC internals in their
typically thorough style. The availability of this information, along with a strong desire to
add hardware to the PC, allowed many people to develop plug-in cards so that the PC
could monitor and even control their environment. Initially, the slots inside the IBM PC
didn`t even have a name. The name ISA, for Industry Standard Architecture, was coined
in the early 1980s. There were no official guidelines on how a PC should be expanded,
so cards made by vendor A could not be used at the same time as cards made by
vendor B. It took until the early 1990s for the ISA bus to be documented (
ISA &EISA
Theory and Operation
by Edward Solari is the classic text for this information). Some
developers took a lower-risk approach and created attachments that plugged into the
serial and parallel ports. But this port resource was quickly depleted, and when more
serial and parallel ports were added via plug-in cards, the internal design of the PC
could not support enough interrupts, Direct Memory Access (DMA) channels, or other
system resources. Sometimes the interactions were subtle and failed only under certain
conditions.The bandwidth of these data paths in and out of the PC was also quite low. A
better solution was required.
The PCI Bus
Many PC and PC component vendors, including Compaq, Digital Equipment, NCR,
IBM,and Intel Corporation, worked together to design a high-bandwidth expansion bus
that was eventually called the Peripheral Components Interconnect bus, or PCI. This bus
definition included configuration information and controls to alleviate the vendor-to-
vendor conflicts of ISA. The PCI bus was included beside the ISA bus inside the PC
host. Software support for automatic configuration was added to Windows so that PCI
cards became easy to install. This was the start of Plug and Play" ,an industry-wide
initiative that governs the way add-in hardware should identify itself.
PCI was an instant success for high-bandwidth devices, but was seen by many as
excessive and complex for the simpler I/O devices. The PCI interface components
typically cost more than a simple I/O device. Another main disadvantage was the
location of the PCI connectors; just like those of their ISA predecessor, they were inside
the PC case.This meant that the case had to be opened, clamping screws undone,
boards plugged exactly right into connectors that were difficult to identify, and then the
system reassembled. This was discouraging for many would-be users because of their
fears that the PC could be easily broken by these actions. PCI was a better solution but
did not address easy expansion of simple I/O.
Several PC-industry leaders worked together to designe an external expansion bus.
Driven by customer demand, it was essential that this bus be simple and low cost.
Consumer focus groups demanded that PC expansion be as easy as connecting a
VCR to a television you should not need to set switches or run software, and you must
be allowed to plug and swap cables while the equipment is turned on.

Page 5
Introduction to USB: (5)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
USB: Easy to Use and Low Cost
With the goal of designing an architecture that would be easy to use and low cost to
implement, industry leaders turned their attention to a high-speed serial bus that came to
be called the Universal Serial Bus (USB). Serial was preferred over parallel because the
cables would be cheaper, and it would be easier to implement dynamic configuration.
Dynamic configuration" meant that the I/O subsystem could be extended or
reconfigured by swapping cables while the PC was running. Rebooting a modern PC
takes several minutes, so this situation had to be avoided in every solution.
A typical configuration included one PC host and many I/O devices. To reduce the
overall system costs, a master-slave implementation was chosen for USB.
The PC host would be the master controlling all traffic on the serial bus. The additional
silicon complexity required to implement the controlling protocols would need to be
implemented only once in the host. The slave I/O device could then be made simpler
and, therefore, cheaper. This asymmetric solution means that the two ends of a cable
are
not
equal. We need to know which
end connects to the master and which
end to the slave! The terminology
adopted by the USB specification is
Upstream
(toward the PC host) and
Downstream
(toward the I/O device).
The upstream end of the cable controls
the protocol and instructs the
downstream end to reply at defined
times.
Another major decision that would
support both design goals was to officially supply power from the PC host. Operating
modes that specify differing power limits are defined, and a good understanding of this
feature allows cheaper and easier-to-use I/O devices to be built. You can, for example,
eliminate the cost of a power supply in simpler I/O devices and ease the design of more
complex I/O devices. Some implementation trade-offs in the I/O devices can also be
made when the system specifies minimum and maximum power levels.

Page 6
Introduction to USB: (6)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
USB Terminology
The USB specification introduced new terms that are used throughout the USB
literature.
A typical configuration has a single PC host with multiple
devices
interconnected by
USB
cables
. The PC host has an embedded
hub,
also called the
root hub
, which
typically contains two or more
USB ports
.
Device configurations range from simple to complex:
Hub:
If a device contains only additional downstream USB ports, then it is called
simply a hub.
I/O device:
An I/O device adds a capability to the PC host. It has a single upstream
connection and interacts with the real world to create or consume data on behalf of
the PC host.
Compound device:
If a device includes both I/O and hub functionality,it is called a
compound device (for example, a keyboard that includes additional USB
downstream ports).
Composite device:
If a single device implements two or more sets of diverse
functions,it is called a composite device (for example, a telephone with keypad and
dual audio channels)

Page 7
Introduction to USB: (7)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
USB Topology
As far as the PC host is concerned, devices are the important feature, and as many as
126 devices can be interconnected using external hubs up to five levels deep.
USB now supports three device speeds. The USB specification initially defined:
low speed (LS)at 1.5 Mbps
full speed (FS)at 12 Mbps.
and new
high speed (HS)at 480 Mbps
was recently added to Version 2.0 of the specification.

Page 8
Introduction to USB: (8)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Low-speed devices are the cheapest to manufacture and are adequate for supporting
low Data-rate devices such as mice, keyboards, and a wealth of other equipment
designed to interact with people. The addition of a high-speed data rate enables high-
bandwidth devices such as full-color page scanners and printers, and mass storage
devices to be designed and added to a PC that supports a high-speed hub.
We shall see that a high-speed hub is more complex than a full-speed hub, and it is
anticipated that it will cost a little more initially. A typical system, therefore, will have a
mixture of HS and FS hubs.
Note that connecting a low-speed device onto the root hub, as I have shown, is a legal
connection; it does, however, preclude connecting high-and full-speed devices to this
node. It would be better, from a system perspective, to connect the low-speed device
onto an FS hub. In the figure, the cables are labeled in different ways for illustrative
purposes only -in fact, all of the USB cables look and operate the same. Note that the
HS hubs communicate with each other at 480 Mbps -they also communicate with HS
devices at 480 Mbps. An FS hub can be connected to an HS hub, but it will only
communicate at 12 Mbps. However, multiple FS hubs may be attached to an HS hub
and each will receive their own 12 Mbps channel -the bandwidth is not shared at this
level. If an FS hub is connected to another FS hub, then the 12 Mbps channel is shared,
as defined by the original USB specification.
Any speed of I/O device may be connected to any downstream port of any hub. The
speed of the I/O device will determine the data rate on the cable to the hub. The only
poor choice is attaching an LS device to an HS hub, as this will limit the speed of the
USB segment to 1.5 Mbps. Fortunately, the operating system will recognize this
suboptimal connection during enumeration of the device, and will recommend that you
detach the LS device and reattach it to an FS hub.

Page 9
Introduction to USB: (9)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
PC Host
A typical configuration has a single PC host. (You can interconnect two PC hosts using
USB) The PC host runs a USB-aware operating system software that supports two
distinct functions - initialization and run time.
The USB initialization software is active at all times and not just during PC host power-
on. Because the initialization software is always active, USB devices can be added and
removed at any time. Once a device is added to a PC host, the device is
enumerated
by the USB initialization software and assigned a unique identifier that is used during
run time.
The PC USB software is layered; layering supports many different software solutions. A
class
is a grouping of devices, with similar characteristics, that can be controlled by a
generic class device driver. Examples of classes include mass-storage devices,
communications devices, audio devices, and human-interface devices. A single I/O
device can belong to multiple classes.
If a device fits neatly into one or more of these predefined classes, then you don't need
to write operating system software, such as a device driver. The software structure
allows you to focus more of your I/O device design effort on the function and usability of
the I/O device and less on the inner workings of an operating system.Vendor-defined
commands are also available for those who want specific functionality for their device
only.
USB cable
A USB cable transports both power supply and data signals. The power supplied by the
USB cable is an important benefit of the USB specification. A simpler I/O device can
rely on the USB cable for all its power needs and will not require the traditional black
brick -plugged into the wall. The power resource is carefully managed by USB, with the
hub device playing the major role.
A hub or I/O device can be self-powered or bus-powered.
ß Self-powered is the traditional approach in which the hub or I/O device has an
additional power cable attached to it.
ß A bus-powered device relies solely on the USB cable for its power needs and is
often less expensive.
The USB cable connectors were specifically designed with the power pins longer than
the signal pins so that power would always be applied before signals. Two different
connector types were defined, to ensure that illegal configurations could not be made.
An A" type connector defines the downstream end of the cable, and a B" type
connector defines the upstream end.
The design center for a USB application is a Desktop PC external expansion bus, so a
length of 5 meters was chosen as the maximum cable length between a hub and a
device. With five levels of hubs, this means that any device will be located within a 30
meter radius of the PC Host. Many applications require a greater distance, and the
industry has responded with Repeater/extender products.

Page 10
Introduction to USB: (10)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
A cable with a 480 Mbps or even a 12 Mbps data rate makes a good antenna,
unfortunately, so cable shielding is required. Shielding adds to the cost of the cable, but
is not required for the 1.5 Mbps
signaling rate, so this approach is
cheaper.The USB specification
allows a system to use a mixture of
480 Mbps, 12 Mbps and 1.5 Mbps
devices on two cable types
(shielded and unshielded), but I
recommend that you
only use
shielded cables
.
The USB specification defines differential signaling on its data wires to reduce the
effects of induced system noise. The USB bus is a point-to-point connection that
operates in half-duplex mode.There is no Direction" bit that identifies the current
transmitter or receiver. This information is embedded in the bus protocol. While this
does simplify the implementation, it also makes it difficult to build a bus repeater or a
bus isolation unit. The fundamental element of communication on the USB bus is a
packet,
and defined sequences of packets are used to build a robust communications
channel.

Page 11
Introduction to USB: (11)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Hub Device
The hub has two major roles: power management and signal distribution.
An external hub has one upstream connection and multiple downstream connections.
The USB specification does not limit the number of downstream connections, but seven
seems to be the practical limit. The most popular hub size has four.
A hub can be self-powered or bus-powered:
˙ The self-powered approach is recommended, in which the hub has an additional
power cable attached to it.If the hub is self-powered, it can provide up to 500 mA to
each of its downstream ports.
˙ A bus-powered device relies solely on the USB cable for its power needs.If the hub
is bus-powered, then it has a maximum of 500 mA available.The hub will use 100
mA for itself, and have only 100 mA available for each of four downstream USB ports
(unless the socket is suspended).The situation is worse if the hub has more than four
downstream ports, in which case less than 100 mA will be available for each port.
Because of the power limitation, I only recommend bus-powered hubs in exceptional
situations. A bus-powered hub can support only 100 mA on each of its downstream
USB ports. Although this is enough to enumerate all I/O devices, it is typically not enough
for most I/O devices to operate.
When first attached to a USB socket, any I/O device (which includes a hub) can always
expect 100 mA to be available. The device uses this power to operate during the
enumeration stage. The device may
not
use more than 100 mA until it is configured; if it
does, the power source on the USB socket will be removed and an error sent to the PC
host. If the I/O device requires more than 100 mA for run-time operation, it can request
up to 500 mA from the hub. If the hub can supply this power, it does so; otherwise, the
I/O device is not configured, and an error message is sent to the PC host. If the I/O
device requires more than 500 mA for run-time operation, the device must be self-
powered and will need a power cord.
It is worth the design effort to reduce your I/O device power to less than 500 mA,
because this eliminates the need for an external power source. An I/O device is required
to power itself down,or suspend,when there is no activity on the USB bus. In the USB
specification, no activity" is defined to mean no bus signaling for 3 ms. The maximum
amount of power that may be drawn during a suspend is 0.5 mA; this is a larger design
challenge.

Page 12
Introduction to USB: (12)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
I/O Device
A PC host creates data for, or consumes data from, the real world, as shown in the
Figure below. A scanner is a good example of a data-creating I/O device, and a printer
is a good example of a data consuming I/O device.
A single I/O device could support both a data creator and a data consumer, so a
different software driver may be required for each of these two distinct tasks. The
software (or logical) view of the USB connection is shown in the Figure below. The
logical view is deliberately general in nature, so that all types of real-world connections
can be made. This diagram is best explained from the bottom up.

Page 13
Introduction to USB: (13)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
The term
endpoint
is used to describe a point at which data enters or leaves a USB
system. An IN endpoint is a data creator, and an OUT endpoint is a data consumer.
Note that the data direction is relative to the PC host -if you remember that the PC host
is the Master" controlling all data movements, then the data direction is easy to
understand. A typical real-world connection may need multiple IN and/or OUT endpoints
to implement a reliable data-delivery scheme. This collection of endpoints is called an
interface,
and is directly related to a real-world connection.The operating system will
have a software driver that corresponds to each interface.The operating system uses
the term
pipe
to describe the logical connection between a software driver on the PC
host and the interface on the I/O device. There is always a one-to-one mapping between
software driver pipes and interfaces. Real-world devices may have multiple interfaces -
a telephone, for example, has a keypad interface and an audio interface. The operating
system will manage the keypad and audio using two separate device drivers. This
decomposition of complex devices into smaller logical interfaces means that building-
block software elements can be quickly used to manage these complex devices. We
don`t have to invest the time and effort to write a special telephone device driver -we can
be operational with the class drivers already included in the operating system. All the
interfaces run concurrently. A collection of interfaces is called a
configuration,
and only
one configuration can be active at a time. A configuration defines the attributes and
features of a specific model. Using configurations allows a single USB connection to
serve many different roles, and the modularity of this system solution saves in
development time and support costs.

Page 14
Introduction to USB: (14)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Adding USB to an "OLD " PC
All desktop PCs and laptops manufactured today contain a USB host controller and one
or more downstream ports. An older PC or laptop may be upgraded easily with a PCI
add-in card or PCMCIA card. You should also upgrade your operating system software
to ensure that you have the best support for USB.
Not all host controllers are equal! The first differentiation is between a V2.0 (480 Mbps)
and a V1.1 (12 Mbps) root hub -this is clearly marked on the product. There are also two
types of V1.1 add-in boards -some contain a single host controller and thus provide 12
Mbps added USB bandwidth, while others provide four host controllers or 48 Mbps of
added bandwidth for your PC host.
You will soon discover that USB is both easy and fun.

Page 15
Introduction to USB: (15)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Software model: Essential Theory
A USB I/O device is a combination of software and hardware. The Figure below shows
the software model of an I/O device attached to a Host PC ­ this comprehensive
diagram is best described from the bottom up.
An I/O device interfaces to the real world. It will use sensors to collect real-world
information such as temperature, speed, color, density and size and will use actuators
and transducers to control the real world. Data collected from the real world is placed in
a local buffer area called an
IN endpoint
­ the Host PC will collect this data later.
Similarly, data is delivered by the host PC into a local buffer called an
OUT endpoint,
this data is then distributed to the real world by the I/O device.
A USB I/O device
requires
a CPU ­ this could be a microcontroller, microprocessor,
digital signal processor or a fixed-function state machine. This CPU is responsible for
translating the signals from the real world into data in the IN endpoint and for translating
the data in the OUT endpoint into signals for the real world. This arrangement of having a
local CPU which can pre- and post-process data on behalf of the Host PC is one of the
key elements of flexibility and standardization within a USB-based system
implementation.
Think of this as an extension to BIOS ­ the Host PC operating system provides some
generic data to a generic I/O device via this OUT endpoint and the specifics of handling
a particular I/O device is managed by the CPU in the I/O device. Similarly specific
actions needed for particular data input devices are handled by the I/O device CPU and
generic data is provided to the Host PC via an IN endpoint. A typical PC-BIOS will
handle keyboard, mouse, display and computer-type I/O devices. The USB model is
extensible to handle
any
type of data acquisition or distribution system and
any
type of
data format including sound and video.

Page 16
Introduction to USB: (16)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
A collection of endpoints is called an
interfac
e.
An interface describes the device CLASS.
Classes are an important concept that I should explain. A typical operating system (such
as Windows or Linux) supports a wide array of I/O devices ­ it broadly groups similar
devices into classes and will use a generic class device driver to interact with this group
of similar devices. A typical operating system will include a range of class drivers, such
as printer, audio, human interface device (HID) and mass storage, to support a wide
collection of I/O devices. All operating systems allow you to write your own device driver
if your particular I/O device is not supported by an included class device driver but, be
warned, it is a LOT of work to create and maintain a device driver. The strategy that I
shall adopt in this paper is to make best use of pre-existing
class drivers.
There is a one-to-one mapping of I/O device interface to Host PC device driver. Or, to
put it another way, an interface will specify which device driver it needs to operate.
The INF file mechanism is used in the Windows operating system to bind an interface to
a device driver. The Windows operating system also provides default INF files to bind
generic devices to generic class device drivers. My examples will use these default files.
Notice from the Figure that an I/O device can have more than one interface. A keyboard
with built- in mouse/track ball would be two interfaces in a single device. A telephone is
an audio class device (for the speech) and a HID class device (for the buttons). Each
interface is supported by a matching device driver. The USB specification also allows
an I/O device to have multiple configurations but this is not supported (yet) by the
Windows operating system.
An I/O device also includes a
control endpoin
t. This endpoint is bi-directional and is
used by the operating system to discover the identity and capabilities of the I/O device
and also to control its operation. Following the initial attachment of a USB I/O device on
to a Host PC, a long "conversation" is held on this control endpoint so that the operating
system can integrate the I/O device into its operating environment. This process is
called
enumeration
in the USB literature and involves a series of pre-formatted
standard USB requests ­ these look quite verbose from a hardware designers
perspective but, the good news, is that this is code that may be reproduced on all
devices (and is included with this article).
The Figure, I did want to stress, it is a MODEL ­ the three pipes shown in the diagram
are implemented on the same USB cable using different packet types and addresses.
Applications programs open named devices and the operating system implements all of
the low-level communications to the I/O device. We, on the I/O device, will see the result
of this as data arriving at OUT endpoints and request for us to supply data on IN
endpoints. The minimal hardware for a USB I/O device is shown in the Figure below. A
transceiver is required to meet the electrical requirements of the bus and a Serial

Page 17
Introduction to USB: (17)
Heinz Rongen
Forschungszentrum Jülich, ZEL
52425 Jülich, Germany
Tel: +49-(0)2461-614512
Fax: +49-(0)2461-613990
Email: H.Rongen@fz-juelich.de
Interface Engine is required to meet the bit timing of the bus. The Serial Interface Engine
is responsible for converting the serial USB packets into valid bytes for the Protocol
Controller ­ these bytes are provided as Endpoints within the SIE. Similarly, the SIE will
transmit bytes from endpoints to USB.
An I/O device can have up to 16 IN and 16 OUT endpoints through components are
typically manufactured with less. All components
must
implement Endpoint 0 and our
examples will also use an IN endpoint 1 and an OUT endpoint 1. The protocol controller
is the I/O device CPU. It executes a program to respond to requests from the Host PC.
A USB I/O device is always a slave and, as such, responds to requests from the Host
PC. These requests could be configuration and setup requests on endpoint 0 or data
requests on endpoint 1. The operation of an I/O device is fixed ­ it always responds in
the same way. Data requests are manipulated by the application firmware ­ endpoint
OUT data is sent through custom I/O devices to the real world and real-world inputs are
prepared in IN endpoints for collection by the Host PC.