Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

USB Complete - The Developer’s Guide (5th Edition)

📅 2022-Jan-17 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ book, usb ⬩ 📚 Archive

Recently, I wanted to learn about the many USB versions and their capabilities. Looking for something easier than the USB specifications to study, I chose USB Complete: The Developer’s Guide. Written by Jan Axelson, the book seemed to be pretty popular since it was already in the 5th edition.

The most relevant USB versions for us today are 2.0, 3.0 and 3.1. Low (1.5 Mbps), full (12 Mbps) and high (480 Mbps) speeds are available in 2.0, SuperSpeed (5 Gbps) was introduced in 3.0 and SuperSpeed Plus (10 Gbps) in 3.1.

Various transfer types are supported in USB. Control transfers are used with all devices for enumeration and discovery. Isochronous transfers are used with audio devices, interrupt transfers with keyboards, mice and bulk transfers for storage data transfer.

There are various classes of devices supported by USB: like mass storage or HID (human interface device) as examples. Classes were designed so that OSes could ship with class drivers, enabling creators of devices to focus on just hardware development and not worry about driver development. In case, you need to go beyond the capabilities of class drivers for your device, it is easiest by using filter drivers in Windows.

There are good illustrations in the book showing the possible tree of controllers, hubs and devices in 2.0 and 3.1. The host computer needs to have one controller (or more) and a root hub with ports. The ports on the hub can connect downstream to more hubs (with their own ports) or to devices.

Tools like the Windows device manager or USBLPM can be used to examine the USB controllers, hubs and devices on a computer. (Personally, I prefer USBView on Windows and on Linux though.)

One of the best features of USB is that it can deliver some amount of power to devices. Many devices can fully function on this power, saving creators from adding expense and complexity and users from extra power connections. Upto 500 mA in 2.0 and 900 mA in 3.1 at a nominal voltage of 5V can be delivered by USB. The new power revision supported up to 5A and 20V, for a total power of 100W.

A chapter towards the end also looked at the various USB connectors. 2.0 has 4 wires and uses type A connectors for host and device and various type B connectors for devices, like micro-B. 3.0 has 10 wires and uses new Type-C connectors which can connect to both hosts and devices and are reversible.

Written for developers, the book covers a lot more related to the USB protocol which I skipped over: wire protocol, packets, descriptors, protocol analysers, Windows device drivers, USB chips and boards. I wish there was more information about the new power revision - this was the one sore point. Also, a lot of the information is duplicated across chapters and the book could have done with a closer proofread. Minor quibbles aside, this was a good resource to learn all about USB. I came away clearly knowing USB’s strengths, limitations and jargon.

Rating: 3/4


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 📧