This book is for developers who are involved with designing or programming devices that use the Universal Serial Bus (USB) interface. If you are a hardware designer, if you write firmware that resides inside USB devices, or if you write applications that communicate with devices, this book is for you.
The USB interface is versatile enough to serve just about any device function. Familiar USB peripherals include mice, keyboards, drives, printers, speakers, and cameras. USB is also suitable for data-acquisition units, control systems, and other devices with specialized functions, including one-of-a-kind designs. The right choices of device hardware, software drivers and development tools and techniques can help you design devices that perform their functions without errors or user aggravation. This book will guide you along the way.
The USB specifications are the ultimate authority on the USB interface, but by design the specification documents omit implementation tips, example code, and information that applies to specific device hardware, software, and other tools and products. This book bridges the gap between the specifications and real-world designs.
These are some of the questions this book answers:
How can I decide if my device should use a USB interface? Find out whether your device should use USB or another interface. If the choice is USB, you’ll learn how to decide which of USB’s five speeds—including USB 3.1’s SuperSpeed and SuperSpeedPlus—and which of USB’s four transfer types are appropriate for your application.
What controller hardware should my device use? Every USB device contains an intelligent controller to manage USB communications. A variety of chip companies offer controller hardware with different architectures and abilities. This book will help you select a controller based on your project’s needs, your budget, and your preferences for chip architecture, programming languages, and tools.
How can applications communicate with my devices? On PCs, applications access a USB device by communicating with the driver the operating system has assigned to the device. You’ll learn if your device can use a class driver provided by the host system’s operating system. For devices that don’t fit a supported class, you can explore options such as Microsoft’s WinUSB driver, other generic drivers, and custom drivers. The example code shows how to detect and communicate with devices from Visual C# applications.
What firmware does my device need to support USB communications? Find out how to write firmware that enables your device to respond to USB requests and events and exchange data for any purpose.
Does my device need its own power supply? The USB interface can provide power to devices, including charging current for battery-powered devices. Learn how to determine if a design can obtain all of its power from the bus, how to meet USB’s requirements for conserving power, and how to charge battery-powered devices from the bus.
How can I implement wireless communications? A variety of USB and other industry standards and technologies enable USB devices to communicate wirelessly. Learn which technology is right for your device.
How can my device access other USB devices? Find out how to develop a host for an embedded system or a USB On-The-Go device that can function as both a USB device and a limited-capability host that accesses other USB devices.
How can I ensure reliable operation? All devices must respond to requests and other events on the USB port. The host computer must detect attached devices, locate appropriate drivers, and exchange data with the devices. This book provides tips, example code, and information about debugging software and hardware to help with these tasks.
To understand the material in the book, it’s helpful to have some experience with digital logic, application programming for PCs and writing embedded code for peripherals. You don’t have to know anything about USB.
What's New in the Fifth Edition
The core of USB has remained much the same since the release of USB 1.0 in 1996. But the interface has expanded to support faster bus speeds, improved power delivery and management, more device classes, wireless communications, support for embedded systems that access USB devices, and more. New and improved chips and development tools have eased the task of developing devices and the software to access them.
This Fifth Edition is revised and updated throughout. New topics include an introduction to USB 3.1 and SuperSpeedPlus, enhanced power delivery and power management, new abilities using USB Type-C connectors, designing devices that use the WinUSB driver without requiring a vendor-provided INF file, new device classes, and how to use free debugging tools. Much of the information in this book applies to any device hardware and the host computer. The example code for applications uses Visual C#.\
One of a hub’s duties is to detect attachment and removal of devices on its downstream-facing ports. Each hub has an interrupt IN endpoint for reporting these events to the host. On system boot-up, hubs inform the host if any devices are attached including additional downstream hubs and any devices attached to those hubs. After boot-up, a host continues to poll periodically (USB 2.0) or receives ERDY TPs (Enhanced SuperSpeed) that request communications to learn of any newly attached or removed devices.
On learning of a new device, the host sends requests to the device’s hub to cause the hub to establish a communications path between the host and device. The host then attempts to enumerate the device by issuing control transfers containing standard USB requests to the device. All USB devices must support control transfers, standard requests, and endpoint zero. For a successful enumeration, the device must respond to requests by returning requested information and taking other requested actions. Read more
My USB Central page has the latest versions of applications and firmware using the example code in the book, plus links to chip and other product information and much more.
1. USB Basics
2. Inside USB Transfers
3. A Transfer Type for Every Purpose
4. Enumeration: How the Host Learns about Devices
5. Control Transfers: Structured Requests for Critical Data
6. Chip Choices
7. Device Classes
8. How the Host Communicates
9. Matching a Driver to a Device
10. Detecting Devices
11. Human Interface Devices: Capabilities
12. Human Interface Devices: Reports
13. Human Interface Devices: Host Application
14. Using WinUSB for Vendor-Defined Functions
15. Using WinUSB’s System INF File
16. Using Hubs to Extend and Expand the Bus
17. Managing Power
18. Testing and Debugging
19. Packets on the Bus
20. Electrical and Mechanical Interface
21. Hosts for Embedded Systems
Developers, Designers and programmers of devices that use the Universal Serial Bus (USB) interface. Hardware designers who write firmware that resides inside USB devices. Engineers who write applications that communicate with devices.
Reviews (Reviews are for previous editions.)................................
Dev Monkey's Jon Titus recommended USB Complete and USB Embedded Hosts.
..........USB 2.0's 650-page specification...is nothing if not ambitious. However, just how much useful information any mortal who wasn't involved in writing this tome can actually glean from it without going insane is a different matter. EEs who are interested in a clearer, more concise presentation might do better to obtain a copy of USB Complete, Second Edition. - Dan Strassberg, EDN.
.....An excellent and highly recommended how-to guide and reference. - Midwest Book Review.
......I know I could build the interface myself with the information provided in the two seminal books on the subject: USB Design by Example by John Hyde and Jan Axelson's USB Complete. - Bill Machrone, PC Magazine.
.......For a very detailed discussion of USB and how to develop custom USB peripherals, check out USB Complete by Jan Axelson. - TJ Byers, Electronics Q&A, Nuts & Volts.
......A great job of presenting the difficult topic of USB peripheral development. - Karl W. Pfalzer, Book Review of the Week, www.enterprise-zone.com.
..... The author has a flair for taking complicated information and making it readable, interesting, and informative. This is the best book on the topic. I recommend it highly. - Jon Titus, Test & Measurement World.
...................Jan Axelson has done it again. The subtitle of this book is Everything You Need to Develop Custom USB Peripherals, and the book lives up to its billing. If you want to add the Universal Serial Bus (USB) to your repertoire, then this is the book for you. -Joseph J. Carr, Nuts & Volts.
............... A readable and comprehensive book that covers all aspects of actually building and coding USB devices. Jan's description of building an HID-class peripheral is the best around. - Jack Ganssle, Embedded Systems Programming.
............This is the best, clearest, single source of USB information I've yet seen published. It's unusual to find such an easy-to-read style combined with real meat. - Lane Hauck, Member of the Technical Staff, Cypress Semiconductor.
....................I tell all my students that they really need this book in their library. - Paul E. Berg, instructor, Annabooks USB Developers Workshop.
..................Many books are full of things that are easy to find out, and skirt around the harder stuff, which you have to really work at. What I really like about this book is that Jan has obviously slogged at the difficult stuff as well. - Dave Wright, Applications Engineer, Cypress Semiconductor. USB Complete provides a great groundwork for anyone working with USB for any purpose, whether it is designing a peripheral or creating host software. This book should be read by anybody getting started with USB. - Joshua Buergel, BSQUARE.
..............If you intend to use USB in your next project I highly recommend USB Complete. This book will give you a complete overview and help you to get started with USB firmware as well as hardware. - Christer Johansson, High Tech Horizon