Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

USB (Universal Serial Bus)

Overview

USB (Universal Serial Bus) is the most common interface for connecting peripherals to computers. It provides power, data transfer, and a standardized connector ecosystem. USB has evolved from 1.5 Mbps (USB 1.0) to 80 Gbps (USB4 v2.0), becoming the universal connectivity standard.

USB Versions

VersionYearSpeedMarketing Name
USB 1.019961.5 Mbps (Low) / 12 Mbps (Full)USB
USB 2.02000480 Mbps (High Speed)Hi-Speed USB
USB 3.020085 GbpsUSB 3.2 Gen 1
USB 3.1201310 GbpsUSB 3.2 Gen 2
USB 3.2201720 GbpsUSB 3.2 Gen 2x2
USB4201940 GbpsUSB4
USB4 v2.0202280 Gbps (120 Gbps asymmetric)USB4 Gen 4

Naming Confusion

USB naming has been notoriously confusing:

  • USB 3.0 = USB 3.2 Gen 1 = SuperSpeed USB
  • USB 3.1 = USB 3.2 Gen 2 = SuperSpeed USB 10 Gbps
  • USB 3.2 = USB 3.2 Gen 2x2 = SuperSpeed USB 20 Gbps

USB Architecture

graph TD
    subgraph "Host (Computer)"
        HC["Host Controller"]
        DR["Device Driver"]
        DR --> HC
    end
    subgraph "USB Topology"
        HC --> Hub1["Root Hub"]
        Hub1 --> D1["Device 1"]
        Hub1 --> Hub2["Hub"]
        Hub2 --> D2["Device 2"]
        Hub2 --> D3["Device 3"]
    end

Host-Device Model

USB uses a host-centric model:

  • Host initiates all transfers
  • Devices respond to host requests
  • Hubs extend the topology (up to 5 levels deep)

Transfer Types

Transfer TypeDescriptionUse Case
ControlDevice setup and configurationEnumeration, commands
BulkLarge, non-time-critical transfersFile transfer, printing
InterruptSmall, periodic, latency-sensitiveMouse, keyboard
IsochronousReal-time, guaranteed bandwidthAudio, video streaming

USB Connectors

graph LR
    subgraph "Connector Types"
        A["Type-A<br/>(host side)"]
        B["Type-B<br/>(device side)"]
        C["Type-C<br/>(reversible)"]
        Mini["Mini-USB<br/>(legacy)"]
        Micro["Micro-USB<br/>(legacy)"]
    end

USB Type-C

The modern standard:

  • Reversible (no wrong orientation)
  • Alternate modes: DisplayPort, Thunderbolt, HDMI
  • Power Delivery: Up to 240W (USB PD 3.1)
  • USB4: Native Type-C only

USB Power Delivery (PD)

PD VersionMax PowerVoltageCurrent
USB 2.02.5W5V500mA
USB 3.04.5W5V900mA
USB PD 2.0100W5-20V5A
USB PD 3.0100W5-20V5A
USB PD 3.1240W5-48V5A

Extended Power Range (EPR): Up to 240W (48V × 5A) for laptops and monitors.

USB Protocol

Transaction Format

sequenceDiagram
    participant Host
    participant Device
    
    Host->>Device: Token Packet (IN/OUT/SETUP)
    alt IN Transfer
        Device->>Host: Data Packet
        Host->>Device: Handshake (ACK)
    else OUT Transfer
        Host->>Device: Data Packet
        Device->>Host: Handshake (ACK)
    end

Packet Types

  • Token: Host tells device what to do (IN, OUT, SETUP)
  • Data: Payload (DATA0, DATA1, DATA2, MDATA)
  • Handshake: ACK, NAK, STALL, NYET

USB4 and Thunderbolt

USB4 is based on Thunderbolt 3 protocol:

FeatureUSB4Thunderbolt 4
Speed40 Gbps40 Gbps
TunnelingUSB, DP, PCIeUSB, DP, PCIe
Min PCIeOptionalRequired (32 Gbps)
Min display1 display2 displays (4K60)
ChargingOptionalRequired (100W)
Daisy-chainOptionalRequired

Tunneling

USB4 can tunnel multiple protocols simultaneously:

┌─────────────────────────────────────┐
│ USB4 Link (40 Gbps)                │
│  ┌─────────┐  ┌─────────┐         │
│  │USB 3.2  │  │DisplayPort│  │PCIe  │  │
│  │Tunnel   │  │Tunnel    │  │Tunnel│  │
│  │(10 Gbps)│  │(32 Gbps) │  │(16Gb)│  │
│  └─────────┘  └─────────┘         │
└─────────────────────────────────────┘

Interview Questions

  1. Q: What is the maximum speed of USB4? A: 40 Gbps (bidirectional). USB4 v2.0 increases this to 80 Gbps, with asymmetric mode up to 120 Gbps in one direction.

  2. Q: How does USB Power Delivery work? A: USB PD negotiates voltage and current between host and device. Starting at 5V, the device can request higher voltages (up to 48V in PD 3.1). Communication happens over the CC (Configuration Channel) pins in the Type-C connector.

  3. Q: What is the difference between USB and PCIe? A: USB is host-centric (host initiates all transfers), designed for peripherals, and provides power. PCIe is peer-to-peer, designed for high-performance components, and doesn’t provide power to devices (except slot power for GPUs).

  4. Q: Why is USB Type-C significant? A: It’s reversible, supports alternate modes (DisplayPort, Thunderbolt, HDMI), enables USB Power Delivery up to 240W, and is required for USB4. It’s becoming the universal connector for all devices.

  5. Q: What is tunneling in USB4? A: USB4 can carry multiple protocols (USB, DisplayPort, PCIe) simultaneously over the same physical link. Each protocol is tunneled in its own container, with bandwidth allocated dynamically.

Common Mistakes

  • ❌ Confusing USB versions (3.0/3.1/3.2 naming is confusing)
  • ❌ Assuming USB Type-C = USB4 (Type-C is the connector, USB4 is the protocol)
  • ❌ Not knowing that USB is host-centric (devices can’t initiate transfers)
  • ❌ Forgetting about power delivery capabilities
  • ❌ Confusing Gbps (gigabits) with GB/s (gigabytes)

Summary

USB is the universal peripheral interface, evolving from 1.5 Mbps to 80 Gbps. USB Type-C is the modern connector, supporting alternate modes and up to 240W power delivery. USB4 is based on Thunderbolt 3, enabling tunneling of USB, DisplayPort, and PCIe over a single cable.

Cross-References

Cross References