Contents
Introduction
1 USB Basics
Uses and limits
Benefits for users
Benefits for developers
Addressing USB’s limits
USB and Ethernet
USB and Thunderbolt
Evolution of an interface
USB 1.0
USB 1.1
USB 2.0
USB 2.1
USB 3.0
USB 3.1
Embedded Host and On-The-Go
Bus components
Topology
Bus speed considerations
Terminology
Division of labor
Host responsibilities
Device responsibilities
Bus speeds and data throughput
Developing a device
Components
Tools for developing
Steps in developing a project
USB 3.1 essentials
Features
Compatibility
Cables
Power
2 Inside USB Transfers
Transfer basics
Essentials
Purposes for communication
Managing data on the bus
Elements of a transfer
Endpoints: the source and sink of data
Transaction types
Pipes: connecting endpoints to the host
Transfer types
Stream and message pipes
Initiating a transfer
USB 2.0 transactions
Transaction phases
Packet sequences
Timing constraints and guarantees
Split transactions
Ensuring successful transfers
Status and control
Reporting the status of control transfers
Error checking
Enhanced SuperSpeed transactions
Packet types
Transferring data
Link Management Packets
3 A Transfer Type for Every Purpose
Control transfers
Availability
Structure
Data size
Speed
Detecting and handling errors
Device responsibilities
Bulk transfers
Availability
Structure
Data size
Speed
Detecting and handling errors
Device responsibilities
Interrupt transfers
Availability
Structure
Data size
Speed
Detecting and handling errors
Device responsibilities
Isochronous transfers
Availability
Structure
Data size
Speed
Detecting and handling errors
Device responsibilities
More about time-critical transfers
Bus bandwidth
Device capabilities
Host capabilities
Host latencies
4 Enumeration: How the Host Learns about Devices
Events and requests
Getting to the Configured state
Device removal
Tips for successful enumeration
Descriptors
Types
Device
Device_qualifier
Configuration
Other_speed_configuration
Interface association
Interface
Endpoint
SuperSpeed endpoint companion
SuperSpeedPlus isochronous endpoint companion
String
Binary device object store (BOS) and device capability
OTG descriptor
Microsoft OS descriptors
Updating descriptors to USB 2.0
Updating descriptors to USB 3.1
5 Control Transfers: Structured Requests for Critical Data
Elements of a control transfer
Setup stage
Data stage
Status Stage
Handling errors
Device firmware
Standard requests
Get Status
Clear Feature
Set Feature
Set Address
Get Descriptor
Set Descriptor
Get Configuration
Set Configuration
Get Interface
Set Interface
Synch Frame
Set SEL
Set Isochronous Delay
Other requests
Class-specific requests
Vendor-defined requests
6 Chip Choices
Components of a USB device
Inside a USB 2.0 controller
Other device components
Simplifying device development
Device requirements
Documentation and example code
Host driver
Development boards
USB microcontrollers
Microchip PIC18
Cypress EZ-USB
ARM processors
Controllers that interface to CPUs
Maxim MAX3420E
PLX Technology USB 3380
FTDI interface chips
7 Device Classes
Purpose
Approved specifications
Elements of a class specification
Defined classes
Audio
Audio/Video
Billboard
Communications
Content security
Device firmware upgrade
Human interface
IrDA bridge
Mass storage
Personal healthcare
Printer
Smart card
Still image capture
Test and measurement
Video
Classes defined by other specifications
Implementing non-standard functions
Choosing a driver
Using a generic driver
Converting from RS-232
Converting from the parallel port
Connecting two PCs
8 How the Host Communicates
Device drivers
The layered driver model
User and kernel modes
Inside the layers
Applications
User-mode client drivers
Kernel-mode client drivers
Low-level host drivers
USB 3.0 drivers
USB 2.0 drivers
Writing drivers
Kernel mode
User mode
Testing tools
Using GUIDs
Device setup GUIDs
Device interface GUIDs
9 Matching a Driver to a Device
Using Device Manager
Viewing devices
Property pages
Device information in the registry
The hardware key
The class key
The driver key
The services key
Using INF files
Driver signing requirements
File structure
Inside an INF file
Using device identification strings
Finding a match
When to provide an INF file
Tools and diagnostic aids
Tips for using INF files
What the user sees
10 Detecting Devices
A brief guide to calling API functions
Managed and unmanaged code
Managing data
Finding a device
Obtaining the device interface GUID
Requesting a pointer to a device information set
Identifying a device interface
Requesting a structure with the device path name
Extracting the device path name
Closing communications
Obtaining a handle
Requesting a communications handle
Closing the handle
Detecting device attachment and removal
Using WMI
Adding a handler for newly arrived devices
Detecting the target device
Adding a handler for removed devices
11 Human Interface Devices: Capabilities
What is a HID?
Hardware requirements
Firmware requirements
Descriptors
The HID interface
HID class descriptor
Report descriptors
HID-specific requests
Get Report
Get Idle
Get Protocol
Set Report
Set Idle
Set Protocol
Transferring data
Writing firmware
Tools
12 Human Interface Devices: Reports
Report structure
Control and data item values
Item format
The Main item type
Input, Output, and Feature items
Collections
The Global item type
Identifying the report
Describing the data’s use
Converting units
Converting raw data
Describing the data’s size and format
Saving and restoring Global items
The Local item type
Physical descriptors
Padding
13 Human Interface Devices: Host Application
HIDClass support routines
Requesting information about the HID
Sending and receiving reports
Providing and using report data
Managing HID communications
Identifying a device
Reading the Vendor ID and Product ID
Getting a pointer to device capabilities
Getting the device’s capabilities
Getting capabilities of buttons and values
Sending and receiving reports
Sending Output reports with interrupt transfers
Reading Input reports with interrupt transfers
Writing Feature reports
Writing Output reports with control transfers
Reading Feature reports
Reading Input reports with control transfers
Closing communications
14 Using WinUSB for Vendor-defined Functions
Capabilities and limits
Device requirements
Host requirements
Driver requirements
Device firmware
Accessing the device
Creating a SafeWinUsbHandle
Obtaining a WinUSB handle
Requesting an interface descriptor
Identifying the endpoints
Setting pipe policies
Writing bulk and interrupt data
Reading bulk and interrupt data
Using vendor-defined control transfers
Selecting an alternate interface
Writing data: isochronous transfers
Reading data: isochronous transfers
Closing communications
15 Using WinUSB’s System INF File
Microsoft OS 1.0 descriptors
Microsoft OS string descriptor
Extended compat ID OS feature descriptor
Extended properties OS feature descriptor
Enumeration
Microsoft OS 2.0 descriptors
Microsoft OS 2.0 platform capability descriptor
Microsoft OS 2.0 descriptor set
Enumeration
16 Using Hubs to Extend and Expand the Bus
USB 2.0
The hub repeater
The transaction translator
The hub controller
Speed
Maintaining active links
USB 3.1
Bus speeds
SuperSpeed
SuperSpeedPlus
Managing traffic
The hub class
Hub descriptors
Hub class requests
17 Managing Power
Power options
Using bus current
Bus voltage
Bus-powered devices
Hub power
Power sources
Over-current protection
Power switching
Conserving power
USB 2.0 Link Power Management
Suspend
Sleep
Enhanced SuperSpeed power management
Advanced power delivery capabilities
Requirements
Negotiating power
Role swapping
Vendor-defined messages
Power management under Windows
Computer power states
Utilities
Battery charging
Charger types
Charger detection
Charging dead or weak batteries
18 Testing and Debugging
Tools
Hardware protocol analyzers
Software protocol analyzers
Traffic generators
Compliance testing
Checklists
USB Command Verifier software
Device Framework tests
Interoperability tests
Current measurement
Electrical tests
Certified USB Logo
Windows hardware certification
Windows hardware certification
Driver signatures
Test-signing a driver
Microsoft USB Test Tool (MUTT)
19 Packets on the Bus
USB 2.0
Low speed and full speed bus states
High speed bus states
Data encoding
Staying synchronized
Timing accuracy
Packet format
Inter-packet delay
Test modes
USB 3.1
Data scrambling
Encoding
Link layer
Reset
Signaling
Negotiating speed
20 Electrical and Mechanical Interface
USB 2.0
Transceivers
Cables and connectors
USB 3.1
Transmitters and receivers
Cables and connectors
USB Type-C cables
Benefits
Cables and connectors
New cable connections
Data routing
Other ways to connect
Inter-Chip
Isolated interfaces
Long distance links
Going wireless
21 Hosts for Embedded Systems
The Targeted Host
The Targeted Peripheral List
Targeted Host types
Bus current
Turning off bus power
The Micro-AB receptacle
Embedded Hosts
Differences from conventional host ports
Host connectors
Functioning as a USB device
OTG devices
Requirements
Cables and connectors
The A-Device and B-Device
The OTG descriptor
Host Negotiation Protocol (HNP)
Role Swap Protocol
Choosing a development platform
Comparing options
Embedded PC
General-purpose microcontroller
Interface chip
Host module
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore