USB Complete: Everything You Need to Develop Custom USB Peripherals


Now in its third edition, this developer's guide to the Universal Serial Bus (USB) interface covers all aspects of project development, including device programming and host application software. This book shows how to transform the information in the USB 3.0 specifications into functioning devices and application software that communicates with the devices. To help build a foundation for design decisions, developers are guided in selecting device-controller hardware. Developers will also learn the benefits of ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (9) from $26.99   
  • New (2) from $125.00   
  • Used (7) from $26.99   
Sort by
Page 1 of 1
Showing 1 – 1 of 2
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2014

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing 1 – 1 of 2
Sort by
Sending request ...


Now in its third edition, this developer's guide to the Universal Serial Bus (USB) interface covers all aspects of project development, including device programming and host application software. This book shows how to transform the information in the USB 3.0 specifications into functioning devices and application software that communicates with the devices. To help build a foundation for design decisions, developers are guided in selecting device-controller hardware. Developers will also learn the benefits of the USB interface, its limitations, and how certain design choices made at the beginning of the project can reduce development time. Recent developments in host and device hardware, more detail on the standard USB classes, application examples using Microsoft's .NET Framework, and information on developing dual-role devices using USB On-The-Go is provided in detail.

Provides a hands-on guide for designing for Universal Serial Bus, including which peripheralcontroller chip a design should use, how to access USB peripherals from Visual-Basic applications, and the use of power design.

Read More Show Less

Editorial Reviews

EDN Magazine
EEs . . . interested in a clearer, more concise presentation might do better to obtain a copy of USB Complete, Second Edition.
Midwest Book Review

Now in an updated and expanded second edition, Jan Axelson's USB Complete: Everything You Need To Develop Custom USB Peripherals continues to be an excellent and highly recommended "how to" guide and reference for anyone seeking to develop devices and software that communicate with USB. This new edition explains what developers need to know about version USB 2.0 specifications and its new high speed of 480 Megabits per second. There is also an added example application code in both Visual C++ and Visual Basic, information about new controller chips and development tools, as well as expanded coverage of the USB support under Windows. The value of this highly recommended text is enhanced further with the author's extensive web page with articles, program code, and other links of special interest to USB devlopers.

Read More Show Less

Product Details

  • ISBN-13: 9781931448024
  • Publisher: Lakeview Research
  • Publication date: 8/1/2005
  • Series: Complete Guides series
  • Edition description: Third edition
  • Edition number: 1
  • Pages: 572
  • Product dimensions: 7.12 (w) x 9.08 (h) x 1.29 (d)

Meet the Author

Jan Axelson is the author of Serial Port Complete, Parallel Port Complete, The Micro Controller Idea Book, and Making Printed Circuit Boards. She lives in Madison, Wisconsin.
Read More Show Less

Read an Excerpt

Chapter 1

A Fresh Start

Computer hardware doesn't often get a chance to start fresh. Anything new usually has to remain compatible with whatever came before it. This is true of both computers and the peripherals that connect to them. Even the most revolutionary new peripheral has to use an interface supported by the computers it connects to.

But what if you had the chance to design a peripheral interface from scratch? What qualities and features would you include? It's likely that your wish list would include these:

  • Easy to use, so there's no need to fiddle with configuration and setup details.
  • Fast, so the interface doesn't become a bottleneck of slow communications.
  • Reliable, so that errors are rare, with automatic correction of errors that do occur.
  • Flexible, so many kinds of peripherals can use the interface.
  • Inexpensive, so users (and the manufacturers who will build the interface into their products) don't balk at the price.
  • Power-conserving, to save battery power on portable computers.
  • Supported by the operating system, so developers don't have to struggle with writing low-level drivers for the peripherals that use the interface.
The good news is that you don't have to create this ideal interface, because the developers of the Universal Serial Bus (USB) have done it for you. USB was designed from the ground up to be a simple and efficient way to communicate with many types of peripherals, without the limitations and frustrations of existing interfaces.

Every new PC has a couple of USB ports that you can connect to a keyboard, mouse, scanners, external disk drives, printers, and standard and custom hardware of all kinds. Inexpensive hubs enable you to add more ports and peripherals as needed.

But one result of USB's ambitious goals has been challenges for the developers who design and program USB peripherals. A result of USB's versatility and ease of use is an interface that's more complicated than the interfaces it replaces. Plus, any new interface will have difficulties just because it's new. When USB first became available on PCs, Windows didn't yet include device drivers for all popular peripheral types. Protocol analyzers and other development tools couldn't begin to be designed until there was a specification to follow, so the selection of these was limited at first. Problems like these are now disappearing, and the advantages are increasing with the availability of more controller chips, new development tools, and improved operating-system support. This book will show you ways to get a USB peripheral up and running as simply and quickly as possible by making the best possible use of tools available now.

This chapter introduces USB, including its advantages and drawbacks, a look at what's involved in designing and programming a device with a USB interface, and a bit of the history behind the interface.

What USB Can Do

USB is a likely solution any time you want to use a computer to communicate with devices outside the computer. The interface is suitable for one-of-kind and small-scale designs as well as mass-produced, standard peripheral types.

To be successful, an interface has to please two audiences: the users who want to use the peripherals and the developers who design the hardware and write the code that communicates with the device. USB has features to please both.

Benefits for Users

From the user's perspective, the benefits to USB are ease of use, fast and reliable data transfers, flexibility, low cost, and power conservation. Table 1-1 compares USB with other popular interfaces.

Ease of Use

Ease of use was a major design goal for USB, and the result is an interface that's a pleasure to use for many reasons: One interface for many devices. USB is versatile enough to be usable with many kinds of peripherals. Instead of having a different connector type and supporting hardware for each peripheral, one interface serves many.

Automatic configuration. When a user connects a USB peripheral to a powered system, Windows automatically detects the peripheral and loads the appropriate software driver. The first time the peripheral connects, Windows may prompt the user to insert a disk with driver software, but other than that, installation is automatic. There's no need to locate and run a setup program or restart the system before using the peripheral.

No user settings. USB peripherals don't have user-selectable settings such as port addresses and interrupt-request (IRQ) lines. Available IRQ lines are in short supply on PCs, and not having to allocate one for a new peripheral is often reason enough to use USB.

Frees hardware resources for other devices. Using USB for as many peripherals as possible frees up IRQ lines for the peripherals that do require them. The PC dedicates a series of port addresses and one interrupt-request (IRQ) line to the USB interface, but beyond this, individual peripherals don't require additional resources. In contrast, each non-USB peripheral requires dedicated port addresses, often an IRQ line, and sometimes an expansion slot (for a parallel-port card, for example).

Easy to connect. With USB, there's no need to open the computer's enclosure to add an expansion card for each peripheral. A typical PC has at least two USB ports. You can expand the number of ports by connecting a USB hub to an existing port. Each hub has additional ports for attaching more peripherals or hubs.

Simple cables. The USB's cable connectors are keyed so you can't plug them in wrong. Cables can be as long as 5 meters. With hubs, a device can be as far as 30 meters from its host PC. Figure 1-1 shows that the USB connectors are small and compact in contrast to typical RS-232 and parallel connectors. To ensure reliable operation, the specification includes detailed requirements that all cables and connectors must meet.

Hot pluggable. You can connect and disconnect a peripheral whenever you want, whether or not the system and peripheral are powered, without damaging the PC or peripheral. The operating system detects when a device is attached and readies it for use.

No power supply required (sometimes). The USB interface includes power-supply and ground lines that provide +5V from the computer's or hub's supply. A peripheral that requires up to 500 milliamperes can draw all of its power from the bus instead of having its own supply. In contrast, most other peripherals have to choose between including a power supply in the device or using a bulky and inconvenient external supply.


USB supports three bus speeds: high speed at 480 Megabits per second, full speed at 12 Megabits per second, and low speed at 1.5 Megabits per second. Every USB-capable PC supports low and full speeds. High speed was added in version 2.0 of the specification, and requires USB 2.0-capable hardware on the motherboard or an expansion card. These speeds are signaling speeds, or the bit rates supported by the bus. The rates of data transfer that individual devices can expect are lower. In addition to data, the bus must carry status, control, and error-checking signals. Plus, multiple peripherals may be sharing the bus. The theoretical maximum rate for a single transfer is over 53 Megabytes per second at high speed, about 1.2 Megabytes per second at full speed, and 800 bytes per second at low speed.

Why three speeds? Low speed was included for two reasons. Low-speed peripherals can often be built more cheaply. And for mice and devices that require flexible cables, low-speed cables can be more flexible because they don't require as much shielding.

Full speed is comparable to or better than the speeds attainable with existing serial and parallel ports and can serve as a replacement for these.

After the release of USB 1.0, it became clear that a faster interface would be useful. Investigation showed that a speed increase of forty times was feasible while keeping the interface backwards-compatible with low- and full-speed devices. High speed became an option with the release of version 2.0 of the USB specification.


The reliability of USB results from both the hardware design and the data-transfer protocols. The hardware specifications for USB drivers, receivers, and cables eliminate most noise that could otherwise cause data errors. In addition, the USB protocol enables detecting of data errors and notifying the sender so it can retransmit.

The detecting, notifying, and retransmitting are typically done in hardware and don't require any programming or user intervention.

Low Cost

Even though USB is more complex than earlier interfaces, its components and cables are inexpensive. A device with a USB interface is likely to cost the same or less than its equivalent with an older interface. For very low-cost peripherals, the low-speed option has less stringent hardware requirements that may reduce the cost further.

Low Power Consumption

Power-saving circuits and code automatically power down USB peripherals when not in use, yet keep them ready to respond when needed. In addition to the environmental benefits of reduced power consumption, this feature is especially useful on battery-powered computers where every milliampere counts.

Benefits for Developers

The above advantages for users are also important to hardware designers and programmers. The advantages make users eager to use USB peripherals, so there's no need to fear wasting time developing for an unpopular interface. And many of the user advantages also make things easier for developers. For example, USB's defined cable standards and automatic error checking mean that developers don't have to worry about specifying cable characteristics or providing error checking in software.

USB also has advantages that benefit developers specifically. The developers include the hardware designers who select components and design the circuits, the programmers who write the software that communicates with USB peripherals, and the programmers who write the embedded code inside the peripherals.

The benefits to developers result from the flexibility built into the USB protocol, the support in the controller chips and operating system, and the fact that the interface isn't controlled by a single vendor. Although users aren't likely to be aware of these benefits, they'll enjoy the result, which is inexpensive, trouble-free, and feature-rich peripherals.


USB's four transfer types and three speeds make it feasible for many types of peripherals. There are transfer types suited for exchanging large and small blocks of data, with and without time constraints. For data that can't tolerate delays, USB can guarantee a transfer rate or maximum time between transfers. These abilities are especially welcome under Windows, where accessing peripherals in real time is often a challenge. The operating system, device drivers, and application software can still introduce unavoidable delays, but USB makes it as easy as possible to achieve transfers that are close to real time.

Unlike other interfaces, USB doesn't assign specific functions to signals or make other assumptions about how the interface will be used. For example, the status and control lines on the PC's parallel port were defined with the intention of communicating with line printers. There are five input lines with assigned functions such as indicating a busy or paper-out condition. When developers began using the port for scanners and other peripherals that send large amounts of data to the PC, the limitation of having just five inputs was an obstacle. (Eventually the interface was expanded to allow eight bits of input.) USB makes no such assumptions and is suitable for just about any device type.

For communicating with common device types such as printers and modems, there are USB classes with defined device requirements and protocols. This saves developers from having to re-invent these.

Operating System Support

Windows 98 was the first Windows operating system to reliably support USB, and its successors, including Windows 2000 and Windows Me, support USB as well. This book focuses on Windows programming for PCs, but other computers and operating systems also have USB support. On Apple's iMac, the only peripheral connectors are USB. Other Macintoshes also support USB, and support is in progress for Linux, NetBSD, and FreeBSD.

However, a claim of operating-system support can mean many things. The level of support can vary! At the most fundamental level, an operating system that supports USB must do three things:

  • Detect when a device is attached to or removed from the system.
  • Communicate with newly attached devices to find out how to exchange data with them.
  • Provide a mechanism that enables software drivers to communicate with the host computer's USB hardware and the applications that want to access USB peripherals.
At a higher level, operating system support may also mean the inclusion of software device drivers that enable application programmers to access devices by calling functions supported by the operating system. If the operating system doesn't include a device driver appropriate for a specific peripheral, the peripheral vendor has to provide one.

Microsoft has added class drivers with each release of Windows. Device types with included drivers now include human interface devices (keyboards, mice, joysticks), audio devices, modems, still-image cameras and scanners, printers, and mass-storage devices. A filter driver can support device-specific features and abilities.

Applications use Applications Program Interface (API) functions or other operating-system components to communicate with the device drivers.

In the future, Windows will likely include support for more device classes. In the meantime, some chip vendors provide drivers that developers can use with their chips, either as-is or with minimal modifications.

USB device drivers use the new Win32 Driver Model (WDM), which defines an architecture for drivers that run under Windows 98, Windows 2000, Windows Me, and future Windows editions. The aim is to enable developers to support all of the operating systems with a single driver. The reality is that some devices still require two, though similar, WDM drivers, one for Windows 98/Windows Me and one for Windows 2000.

Because Windows includes low-level drivers that handle communications with the USB hardware, writing a USB device driver is easier than writing a driver for devices that use other interfaces.....

Read More Show Less

Table of Contents

Introduction xiii
1. A Fresh Start 1
What USB Can Do 3
It's Not Perfect 11
History 16
2. Is USB Right for My Project? 21
Fast Facts 21
The Development Process 35
3. Inside USB Transfers 39
Transfer Basics 40
Elements of a Transfer 44
Ensuring that Transfers Are Successful 61
4. A Transfer Type for Every Purpose 71
Control Transfers 71
Bulk Transfers 78
Interrupt Transfers 81
Isochronous Transfers 85
More about Time-critical Transfers 89
5. Enumeration: How the Host Learns about Devices 93
The Process 94
Descriptor Types and Contents 101
Descriptors in 2.0-compliant Devices 116
6. Control Transfers: Structured Requests for Critical Data 119
Elements of a Control Transfer 119
The Requests 127
7. Chip Choices 141
Elements of a USB Controller 142
Simplifying the Development Process 147
A Look at Some Chips 157
8. Inside a USB Controller: the Cypress enCoRe 171
Selecting a Chip 172
The Assembler 173
Programming in C 180
Chip Architecture 181
USB Communications 187
Other I/O 192
Other Chip Capabilities 197
9. Writing Firmware: the Cypress enCoRe 209
Hardware and Firmware Responsibilities 209
Hardware Development Tools 219
10. How the Host Communicates 231
Device Driver Basics 231
The Win32 Driver Model 237
Choosing a Driver Type 248
Writing a Custom Driver 249
11. How Windows Selects a Driver 255
The Process 255
Inside an INF File 262
Creating INF Files 271
12. Device Classes 275
Uses of Classes 276
Matching a Device to a Class 279
13. Human Interface Devices: Firmware Basics 293
What is a HID? 294
Identifying a Device as a HID 299
HID-specific Requests 306
Transferring Data 314
14. Human Interface Devices: Reports 321
Report Structure 321
The Main Item Type 325
The Global Item Type 330
The Local Item Type 339
15. Human Interface Devices: Host Application Primer 343
Host Communications Overview 344
Using API Functions 348
Device Attachment and Removal 362
16. Human Interface Devices: Host ApplicationExample 365
Finding a Device 366
Reading and Writing Data 384
17. Device Testing 401
USB Check's Test Suite 402
Test Equipment 409
Testing and Logos 417
18. Hubs: the Link between Devices and the Host 423
Hub Basics 424
The Hub Class 434
19. Managing Power 443
Powering Options 443
Hub Power 449
Saving Power 452
20. Signals and Encoding 457
Bus States 457
Data Encoding 462
Packet Format 467
Test Modes 470
21. The Electrical Interface 473
Transceivers and Signals 474
Signal Voltages 484
Cables 485
Ensuring Signal Quality 492
Index 497
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)