From the Introduction
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. 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.