Connectivity

USB

USB, or Universal Serial Bus, is a widely used interface for connecting computers, microcontrollers, storage devices, phones, peripherals and other electronic equipment. USB can carry both digital data and electrical power, making it one of the most common interfaces in modern electronics.

What Is USB?

USB stands for Universal Serial Bus. It is a standard interface designed to allow electronic devices to communicate and, in many cases, exchange electrical power.

USB is commonly used for:

  • Keyboards
  • Mice
  • USB flash drives
  • Printers
  • External hard drives
  • Smartphones
  • Development boards
  • Microcontrollers
  • Audio interfaces
  • USB chargers

How USB Works

USB uses a host-and-device architecture. A USB host controls the bus and communicates with connected USB devices.

USB Host
   │
   │ USB Cable
   ▼
USB Device
   │
   ▼
Data / Power

A computer is commonly the USB host while devices such as keyboards, flash drives and development boards operate as USB devices.

USB Host

The USB host controls communication on the USB bus.

Typical USB hosts include:

  • Desktop computers
  • Laptops
  • USB host controllers
  • Some smartphones
  • Embedded systems
  • Single-board computers

USB Device

A USB device connects to a USB host and provides a particular function.

Examples include:

  • Keyboard
  • Mouse
  • USB storage
  • Printer
  • Webcam
  • Audio interface
  • Serial adapter
  • Development board

USB Hub

A USB hub allows multiple USB devices to share a single USB host connection.

             USB Host
                │
                ▼
             USB Hub
          ┌─────┼─────┐
          │     │     │
          ▼     ▼     ▼
       Keyboard Mouse USB Drive

A hub can therefore expand the number of USB ports available to a host.

USB Generations

USB has evolved through several generations with increasing data transfer capabilities.

  • USB 1.x
  • USB 2.0
  • USB 3.x
  • USB4

The exact performance depends on the USB specification, connector, cable, host and device.

USB 1.x

USB 1.x introduced the basic USB architecture and provided relatively low-speed data communication compared with later generations.

USB 1.x included low-speed and full-speed operating modes.

USB 2.0

USB 2.0 significantly increased the available data-transfer rate over USB 1.x.

USB 2.0 is still extremely common in computers, embedded systems, microcontrollers and electronic modules.

The commonly quoted maximum signaling rate for USB 2.0 High-Speed is 480 Mbit/s.

USB 3.x

USB 3.x introduced substantially higher data-transfer capabilities than USB 2.0.

Different USB 3.x generations have different signaling rates, so the USB version and actual product specification should be checked rather than relying only on the physical connector.

USB4

USB4 is a newer USB architecture designed for high-speed connectivity and advanced data transport.

USB4 uses the USB Type-C connector.

The capabilities available to a particular device depend on its USB implementation and supported modes.

USB Connectors

USB connectors have changed considerably over the years. Common connector types include:

  • USB Type-A
  • USB Type-B
  • Mini-USB
  • Micro-USB
  • USB Type-C

The connector shape does not by itself guarantee a particular USB data rate or feature set.

USB Type-A

USB Type-A is the familiar rectangular USB connector commonly found on computers, chargers, hubs and other equipment.

It has traditionally been used on the host side of many USB connections.

USB Type-B

USB Type-B connectors have been widely used on equipment such as printers and other peripherals.

Several physical variants of Type-B connectors exist, so the exact connector must be identified before selecting a replacement cable.

Micro-USB

Micro-USB connectors were widely used on older smartphones, development boards, small electronic devices and charging equipment.

Different Micro-USB implementations can support different USB capabilities.

Mini-USB

Mini-USB connectors were commonly used in older cameras, GPS devices, USB peripherals and other electronics.

They have largely been replaced by Micro-USB and USB Type-C in newer equipment.

USB Type-C

USB Type-C is a small reversible connector.

It can support several different functions depending on the device and cable, including USB data communication and power delivery.

USB Type-C does not automatically mean that a device supports every high-speed USB feature.

USB Data Lines

USB 2.0 uses a differential data pair:

D+
D-

The two signals are used together for USB data communication.

USB 3.x implementations add additional high-speed differential pairs.

USB Differential Signaling

USB uses differential signaling for its data communication.

The receiver determines the signal from the voltage relationship between the two conductors rather than simply measuring one signal against ground.

This helps improve noise immunity and supports high-speed data communication.

USB Power

USB can provide electrical power to connected devices.

A basic USB connection commonly contains:

VBUS
GND
D+
D-

The exact power capabilities depend on the USB specification, charger, host, device and negotiated power mode.

USB VBUS

VBUS is the USB power supply line.

A USB device can use VBUS to obtain power from the host or charger, depending on the type of connection.

The permitted voltage and current depend on the USB specification and power mode.

USB Ground

USB provides a ground connection as part of the cable interface.

The ground reference is important for both power and signal integrity. Poor grounding or damaged cables can cause USB communication problems.

USB Power vs USB Data

USB power and USB data are separate functions.

USB Cable
   │
   ├── Power
   │    ├── VBUS
   │    └── GND
   │
   └── Data
        ├── D+
        └── D-

A cable or device can therefore have power available while data communication is not functioning.

USB Charging

USB is widely used for charging electronic devices.

Charging capabilities vary significantly between basic USB connections and modern USB power systems.

The charger, cable and device must support the required power mode.

USB Power Delivery

USB Power Delivery, commonly called USB PD, provides a mechanism for negotiating power capabilities between compatible devices.

USB PD can support power levels substantially higher than basic USB power modes.

The actual voltage and current depend on the negotiated power profile and the capabilities of the equipment.

USB Cable

The cable is an important part of a USB system.

A cable can affect:

  • Data speed
  • Signal integrity
  • Maximum charging current
  • Power loss
  • Connector compatibility

A cable with a compatible connector is not necessarily capable of supporting every USB feature.

USB Cable Length

USB signaling becomes more difficult as cable length increases.

The maximum practical length depends on the USB generation, cable construction and required data rate.

High-speed USB connections generally require greater attention to cable quality and signal integrity.

USB Enumeration

When a USB device is connected, the host identifies and configures the device. This process is called enumeration.

Device Connected
       │
       ▼
USB Detection
       │
       ▼
Device Identification
       │
       ▼
Configuration
       │
       ▼
Device Ready

The host obtains information about the device and determines which driver or device class should be used.

USB Device Descriptors

USB devices provide descriptors containing information about the device and its interfaces.

Descriptors can identify information such as:

  • Vendor
  • Product
  • Device class
  • Interfaces
  • Endpoints
  • Configuration information

USB Device Classes

USB defines device classes that allow operating systems to understand common types of USB devices.

Examples include:

  • HID
  • Mass Storage
  • CDC
  • Audio
  • Video

USB HID

HID stands for Human Interface Device.

HID devices include:

  • Keyboards
  • Mice
  • Game controllers
  • Other human-interface equipment

HID devices can often operate using standard operating-system support.

USB Mass Storage

USB Mass Storage devices allow computers to access storage through USB.

Examples include:

  • USB flash drives
  • External hard drives
  • External SSDs
  • Memory-card readers

USB CDC

CDC stands for Communications Device Class.

CDC-based devices can provide communication interfaces that appear to the host as a serial-type interface.

Development boards and USB-to-serial devices commonly use USB communication classes related to CDC.

USB Audio

USB Audio allows compatible computers and devices to exchange digital audio through USB.

Examples include:

  • USB microphones
  • USB sound cards
  • USB DACs
  • Audio interfaces

USB Video

USB Video devices can provide video data to a host computer.

Webcams are a common example.

USB-to-Serial Adapter

A USB-to-serial adapter converts between USB communication and another serial interface such as UART.

Computer
   │
   │ USB
   ▼
USB-to-UART
   │
   │ TX / RX
   ▼
Microcontroller

These adapters are commonly used to program and debug development boards.

USB and Microcontrollers

Some microcontrollers contain an integrated USB peripheral.

Others require an external USB interface IC.

USB Connector
     │
     ▼
USB Interface
     │
     ▼
Microcontroller
     │
     ▼
Application

USB on ESP32

USB capability depends on the specific ESP32 family member and board. Not every ESP32 device has the same native USB capabilities.

Some boards use a separate USB-to-UART bridge for programming and serial communication.

When selecting an ESP32 board for USB applications, check the exact chip and board implementation.

USB Programming

Many development boards use USB for programming firmware.

Computer
   │
   │ USB
   ▼
Development Board
   │
   ▼
Microcontroller
   │
   ▼
Firmware

The USB connection may communicate with a USB-to-UART bridge or directly with a microcontroller's native USB peripheral.

USB-to-UART Bridge

A USB-to-UART bridge contains an interface IC that converts USB data to UART signals.

Common applications include:

  • Microcontroller programming
  • Serial debugging
  • Embedded development
  • Configuration of electronic equipment

USB ESD Protection

USB connectors are exposed to users and can experience electrostatic discharge.

USB interfaces may therefore use transient protection devices such as ESD protection arrays.

USB Connector
     │
     ▼
ESD Protection
     │
     ▼
USB Controller

The protection device should be selected for the required USB signal speed and electrical characteristics.

USB Signal Integrity

High-speed USB requires careful PCB layout and suitable cable construction.

Important considerations include:

  • Differential impedance
  • Trace length
  • Pair routing
  • Grounding
  • Connector quality
  • ESD protection capacitance
  • Signal reflections

USB PCB Layout

USB differential pairs should generally be routed according to the requirements of the particular USB specification and transceiver.

Avoid unnecessary discontinuities, excessive vias and poorly controlled routing.

The manufacturer's reference design should be followed whenever available.

USB Troubleshooting

When a USB device is not detected, troubleshoot the system systematically.

  1. Check the USB cable.
  2. Check the connector.
  3. Check the power supply.
  4. Check VBUS.
  5. Check the USB data lines.
  6. Check device enumeration.
  7. Check the operating-system driver.
  8. Test another USB port.
  9. Test another computer.

USB Device Has Power but Is Not Detected

A USB device can receive power while data communication is not working.

Possible causes include:

  • Damaged data wires
  • Incorrect D+ / D- connections
  • Faulty USB connector
  • USB controller fault
  • Incorrect firmware
  • Driver problem
  • Signal-integrity problem

USB Cable Problems

Some cables are designed primarily for charging and may not provide the expected data functionality.

When troubleshooting USB communication, test with a known-good data-capable cable.

USB Connector Faults

USB connectors can fail because of:

  • Mechanical damage
  • Loose solder joints
  • Oxidation
  • Broken pins
  • Repeated insertion and removal

Inspect the connector carefully before replacing the USB controller.

Testing USB Power

A multimeter can be used to check the USB power supply.

Check the voltage between VBUS and GND.

 Meter Red → VBUS Meter Black → GND 

The measured voltage should be compared with the expected voltage for the particular USB implementation.

Testing USB Data Lines

Basic continuity testing can identify obvious broken connections, but USB data communication operates at high speed and requires more than a multimeter for complete signal analysis.

An oscilloscope or USB protocol analyzer can provide much more useful information for difficult USB faults.

USB Protocol Analyzer

A USB protocol analyzer can capture and decode USB communication.

It can help diagnose:

  • Enumeration failures
  • Protocol errors
  • Device descriptors
  • Transfer problems
  • USB communication timing

USB Faults

Symptom Possible Cause
No power Cable, connector, fuse or power circuit fault
Power present but no detection Data connection, controller or driver problem
Intermittent connection Connector, cable or signal-integrity problem
Slow transfer USB mode, cable, device or host limitation
Device disconnects Power instability, cable or communication problem
USB port gets hot Possible short circuit or excessive current

USB Short Circuit

A short circuit between USB power and ground can cause excessive current and potentially damage the host or device.

Before connecting a repaired USB board to expensive equipment, inspect the power rails and check for obvious shorts.

USB Port Protection

USB ports can include protection components such as:

  • Resettable fuses
  • TVS devices
  • ESD protection arrays
  • Power switches

These components can fail after an electrical or ESD event and should be considered during troubleshooting.

USB Replacement

When replacing a USB connector or USB interface component, verify:

  • Connector type
  • Pin configuration
  • Mechanical dimensions
  • Mounting style
  • USB generation
  • Power requirements
  • Data requirements
  • Board footprint

How to Select a USB Connector

  1. Identify the required connector type.
  2. Determine whether the connector is host or device oriented.
  3. Check the required USB generation.
  4. Check power requirements.
  5. Check mechanical dimensions.
  6. Check mounting style.
  7. Check pinout.
  8. Check connector durability.
  9. Check cable compatibility.

How to Select a USB Cable

  1. Identify both connector types.
  2. Determine whether data communication is required.
  3. Determine the required USB generation.
  4. Check supported charging current.
  5. Check cable length.
  6. Check cable construction.
  7. Check whether USB Power Delivery is required.

USB Applications

  • Computer peripherals
  • Mobile phones
  • Development boards
  • Microcontrollers
  • USB storage
  • Printers
  • Audio interfaces
  • Digital cameras
  • Industrial equipment
  • Test instruments
  • Programming interfaces
  • Charging systems

Advantages of USB

  • Widely supported
  • Provides both data and power
  • Plug-and-play operation for many device classes
  • Many connector options are available
  • High-speed versions are available
  • Useful for embedded development
  • Extensive operating-system support

Limitations of USB

  • Different USB generations can cause compatibility confusion.
  • Connector shape does not guarantee USB speed.
  • Some cables support charging but not all data functions.
  • High-speed USB requires careful signal integrity.
  • Long cables can reduce signal quality.
  • Power capability varies between USB implementations.

Common USB Design Mistakes

  • Assuming every USB-C port supports the same functions
  • Using a charging-only cable for data communication
  • Ignoring USB power requirements
  • Incorrect D+ and D- routing
  • Ignoring ESD protection
  • Poor differential-pair PCB layout
  • Using inappropriate connectors
  • Ignoring cable quality at high data rates
  • Connecting incompatible voltage levels
  • Assuming USB power automatically means USB data is working

Key Points

  • USB stands for Universal Serial Bus.
  • USB can provide both digital communication and electrical power.
  • A USB host controls communication with USB devices.
  • USB devices provide functions such as storage, HID, audio and serial communication.
  • USB 2.0 uses D+ and D- differential data lines.
  • USB 3.x adds additional high-speed signal pairs.
  • USB Type-C is a connector type and does not automatically indicate every USB feature.
  • USB Power Delivery allows compatible devices to negotiate higher power levels.
  • USB enumeration allows the host to identify and configure a connected device.
  • USB-to-UART bridges are widely used in microcontroller development.
  • Good cable quality and PCB layout become increasingly important at higher USB speeds.
  • Always check connector type, USB generation, cable capability, power requirements and device compatibility when working with USB.

Continue Learning About USB

The next pages can cover USB connectors, USB standards, USB-C, USB power, USB data lines, USB host and device modes, USB-to-UART interfaces, microcontroller USB, USB testing, troubleshooting, replacement and selection.