USB-to-Serial adapters: Difference between revisions

From UART Wiki
Jump to navigation Jump to search
m (updated note about CH340G)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== USB-to-Serial Adapters ==
== USB-to-Serial Adapters ==
'''USB-to-Serial adapters'''' (often called “USB-UART” or “USB-TTL” adapters) provide a bridge between a host computer’s USB port and the UART (Universal Asynchronous Receiver/Transmitter) interface on an embedded hardware.  They are indispensable tools for firmware flashing, console access, bootloader communication, and low-level hardware debugging.
'''USB-to-Serial adapters''' (often called “USB-UART” or “USB-TTL” adapters) provide a bridge between a host computer’s USB port and the UART (Universal Asynchronous Receiver/Transmitter) interface on an embedded hardware.  They are indispensable tools for firmware flashing, console access, bootloader communication, and low-level hardware debugging.


=== Overview ===
=== Overview ===
USB-to-Serial adapters all share the core function of converting USB packets to asynchronous serial data, but differ by:
USB-to-Serial adapters all share the core function of converting USB packets to asynchronous serial data, but differ by:
* **Signal Standard**: RS-232 vs TTL-level UART   
* '''Signal Standard''': RS-232 vs TTL-level UART   
* **Voltage Levels**: 3.3V, 5V, adjustable (1.8V, 2.5V)   
* '''Voltage Levels''': 3.3V, 5V, adjustable (1.8V, 2.5V)   
* **Chipset**: FTDI (FT232R/FT231X), Prolific (PL2303), Silicon Labs (CP2102/CP2104), WCH (CH340G/CH341A), etc.   
* '''Chipset''': FTDI (FT232R/FT231X), Prolific (PL2303), Silicon Labs (CP2102/CP2104), WCH (CH340G/CH341A), etc.   
* **Form Factor & Connectors**: 6-pin 0.1″ header, micro-USB, USB-C, DB9 shell   
* '''Form Factor & Connectors''': 6-pin 0.1″ header, micro-USB, USB-C, DB9 shell   
* **Additional Lines**: RTS/CTS, DTR, DSR, RI, DCD for hardware flow control and reset signals   
* '''Additional Lines''': RTS/CTS, DTR, DSR, RI, DCD for hardware flow control and reset signals   


=== Key Components ===
=== Key Components ===
Line 16: Line 16:
! Chipset !! Vendor !! USB <> UART !! Voltage(s) !! Flow-Control !! Notes
! Chipset !! Vendor !! USB <> UART !! Voltage(s) !! Flow-Control !! Notes
|-
|-
| FT232R || FTDI || Full-Speed USB 2.0 || 1.8–5.0 V || RTS, CTS, DTR, DSR || Gold-standard, EEPROM-configurable
| [[FT232RL]]|| FTDI || Full-Speed USB 2.0 || 1.8–5.0 V || RTS, CTS, DTR, DSR || Commonly used, EEPROM-configurable
|-
|-
| CP2102/CQ1 || Silicon Labs || Full-Speed USB 2.0 || 3.3 V, 5 V || RTS, CTS || Low-cost, integrated EEPROM
| [[CP2102]]/CQ1 || Silicon Labs || Full-Speed USB 2.0 || 3.3 V, 5 V || RTS, CTS || Low-cost, integrated EEPROM
|-
|-
| PL2303HX || Prolific || Full-Speed USB 2.0 || 5 V || RTS, CTS || Widely cloned; watch for fake chips
| [[PL2303|PL2303HX]]|| Prolific || Full-Speed USB 2.0 || 5 V || RTS, CTS || Widely cloned; watch for fake chips
|-
|-
| CH340G || WCH || Full-Speed USB 2.0 || 3.3 V, 5 V || RTS, CTS || Very cheap; extremely reliable with good support
| [[CH340G]]|| WCH || Full-Speed USB 2.0 || 3.3 V, 5 V || RTS, CTS || Very cheap; extremely reliable with good support
|-
|-
| CP2104 || Silicon Labs || Full-Speed USB 2.0 || 1.8–5.0 V || RTS, CTS, DTR || Newer silicon with lower power
| CP2104 || Silicon Labs || Full-Speed USB 2.0 || 1.8–5.0 V || RTS, CTS, DTR || Newer silicon with lower power
Line 29: Line 29:
==== Signal Levels & Pinouts ====
==== Signal Levels & Pinouts ====
=== TTL vs RS-232 ===
=== TTL vs RS-232 ===
* **TTL-Level UART**: Logic-level serial at 0 V–V<sub>CC</sub> (3.3 V or 5 V). Used on microcontrollers and SoCs.   
* '''TTL-Level UART''': Logic-level serial at 0 V–V<sub>CC</sub> (3.3 V or 5 V). Used on microcontrollers and SoCs.   
* **RS-232**: ±3 V to ±15 V swings with inverted logic. Requires level-shifter (MAX232) beyond TTL.
* '''RS-232''': ±3 V to ±15 V swings with inverted logic. Requires level-shifter (MAX232) beyond TTL.


{| class="wikitable"
{| class="wikitable"
Line 49: Line 49:


=== Connectors & Cabling ===
=== Connectors & Cabling ===
* **0.1″ 6-Pin Header**: Typical breakout boards; pin order varies—check silkscreen (“GND, CTS, VCC, TXD, RXD, RTS” common).   
* '''0.1″ 6-Pin Header''': Typical breakout boards; pin order varies—check silkscreen (“GND, CTS, VCC, TXD, RXD, RTS” common).   
* **DB9 Male/Female**: Full-sized RS-232 adapters; DB9 pinout per TIA/EIA-232-F standard.   
* '''DB9 Male/Female''': Full-sized RS-232 adapters; DB9 pinout per TIA/EIA-232-F standard.   
* **Inline Cables**: Must verify pin-color mapping (e.g. black=GND, red=VCC, orange=TX, yellow=RX).
* '''Inline Cables''': Must verify pin-color mapping (e.g. black=GND, red=VCC, orange=TX, yellow=RX).


=== Drivers & Host Configuration ===
=== Drivers & Host Configuration ===
Most USB-UART ICs require vendor drivers:
Most USB-UART ICs require vendor drivers:
* **FTDI**: Native on Windows/macOS/Linux but may need VCP drivers from FTDI website.   
* '''[[FTDI]]''': Native on Windows/macOS/Linux but may need VCP drivers from FTDI website.   
* **CP210x**: Silicon Labs provides VCP drivers; Linux kernel has built-in support (`cp210x`).   
* '''[[CP2102|CP210x]]''': Silicon Labs provides VCP drivers; Linux kernel has built-in support (<code>cp210x</code>).   
* **CH340**: Linux requires `ch341` module; Windows installer from WCH.   
* '''[[CH340]]''': Linux requires <code>ch341</code> module; Windows installer from WCH.   
* **PL2303**: Windows driver from Prolific; beware counterfeit devices with wrong PID.
* '''[[PL2303]]''': Windows driver from Prolific; beware counterfeit devices with wrong PID.


After installation, adapters appear as:
After installation, adapters appear as:
* **Windows**: COMx (e.g. `COM3`, `COM4`)   
* '''Windows''': COMx (e.g. <code>COM3</code>, <code>COM4</code>)   
* **Linux/macOS**: `/dev/ttyUSBx`, `/dev/tty.SLAB_USBtoUART`, `/dev/cu.usbserial-XXXXX`
* '''Linux/macOS''': <code>/dev/ttyUSBx</code>, <code>/dev/tty.SLAB_USBtoUART</code>, <code>/dev/cu.usbserial-XXXXX</code>


=== Practical Usage ===
=== Practical Usage ===


==== Console & Bootloader Access ====
==== Console & Bootloader Access ====
1. **Connect GND first** to establish common reference.
 
2. **Wire TX↔RX** (cross): adapter TX ⇒ device RX; adapter RX ⇒ device TX.   
# '''Connect GND first''' to establish common reference.
3. **Power**: Some boards can be powered via adapter VCC, but prefer separate regulated supply.   
# '''Wire TX↔RX''' (cross): adapter TX ⇒ device RX; adapter RX ⇒ device TX.   
4. **Open Terminal**: `screen /dev/ttyUSB0 115200,8N1` or `minicom -D /dev/ttyUSB0 -b 115200`.   
# '''Power''': Some boards can be powered via adapter VCC, but prefer separate regulated supply.   
5. **Reset Sequences**: Use DTR/RTS toggles for automatic reset into bootloader (e.g. Arduino auto-upload).
# '''Open Terminal''': <code>screen /dev/ttyUSB0 115200,8N1</code> or <code>minicom -D /dev/ttyUSB0 -b 115200</code>.   
# '''Reset Sequences''': Use DTR/RTS toggles for automatic reset into bootloader (e.g. Arduino auto-upload).


==== Firmware Flashing & Modding ====
==== Firmware Flashing & Modding ====
* **UART Bootloaders**: Many MCUs (STM32, ESP32) include UART ROM bootloader—hold BOOT0, toggle reset.   
* '''UART Bootloaders''': Many MCUs (STM32, ESP32) include UART ROM bootloader—hold BOOT0, toggle reset.   
* **Protocol Tools**: `stm32flash`, `esptool.py`, `flashrom` over serial protocols.   
* '''Protocol Tools''': <code>stm32flash</code>, <code>esptool.py</code>, <code>flashrom</code> over serial protocols.   
* **Voltage Translation**: When target uses 1.8 V logic, add a bidirectional level shifter (e.g. TXB0108).
* '''Voltage Translation''': When target uses 1.8 V logic, add a bidirectional level shifter (e.g. TXB0108).


==== Troubleshooting & Advanced Hacks ====
==== Troubleshooting & Advanced Hacks ====
* **Baud Rate Mismatch**: Check both sides match—common rates: 9600, 115200, 921600 bps.   
* '''Baud Rate Mismatch''': Check both sides match—common rates: 9600, 115200, 921600 bps.   
* **Flow-Control Issues**: Disable hardware flow in software if CTS/RTS not used or miswired.   
* '''Flow-Control Issues''': Disable hardware flow in software if CTS/RTS not used or miswired.   
* **Buffer Latency**: FT232 chips allow latency timer tuning via EEPROM (`ftdi_eeprom` on Linux).   
* '''Buffer Latency''': FT232 chips allow latency timer tuning via EEPROM (<code>ftdi_eeprom</code> on Linux).   
* **Counterfeit Detection**: Genuine FTDI chips enumerate as “FT232R USB UART”; fakes may require VCP patch.   
* '''Counterfeit Detection''': Genuine FTDI chips enumerate as “FT232R USB UART”; fakes may require VCP patch.   
* **Solder-Mod Kits**: Add solder-jumper pads to switch voltage level or enable 1.8 V rail.   
* '''Solder-Mod Kits''': Add solder-jumper pads to switch voltage level or enable 1.8 V rail.   
* **Signal Integrity**: Keep wiring <10 cm; add series 27 Ω resistors on TX lines to reduce overshoot.
* '''Signal Integrity''': Keep wiring <10 cm; add series 27 Ω resistors on TX lines to reduce overshoot.


=== Best Practices ===
=== Best Practices ===
* Always verify **GND continuity** before powering.   
* Always verify '''GND continuity''' before powering.   
* Use **ESD protection** when probing exposed pads.   
* Use '''ESD protection''' when probing exposed pads.   
* Avoid back-feeding USB port power—disconnect VCC if powering target separately.   
* Avoid back-feeding USB port power—disconnect VCC if powering target separately.   
* Label and document pin mapping on custom adapters.
* Label and document pin mapping on custom adapters.

Latest revision as of 17:31, 19 May 2025

USB-to-Serial Adapters

USB-to-Serial adapters (often called “USB-UART” or “USB-TTL” adapters) provide a bridge between a host computer’s USB port and the UART (Universal Asynchronous Receiver/Transmitter) interface on an embedded hardware. They are indispensable tools for firmware flashing, console access, bootloader communication, and low-level hardware debugging.

Overview

USB-to-Serial adapters all share the core function of converting USB packets to asynchronous serial data, but differ by:

  • Signal Standard: RS-232 vs TTL-level UART
  • Voltage Levels: 3.3V, 5V, adjustable (1.8V, 2.5V)
  • Chipset: FTDI (FT232R/FT231X), Prolific (PL2303), Silicon Labs (CP2102/CP2104), WCH (CH340G/CH341A), etc.
  • Form Factor & Connectors: 6-pin 0.1″ header, micro-USB, USB-C, DB9 shell
  • Additional Lines: RTS/CTS, DTR, DSR, RI, DCD for hardware flow control and reset signals

Key Components

USB-UART Bridge ICs

Chipset Vendor USB <> UART Voltage(s) Flow-Control Notes
FT232RL FTDI Full-Speed USB 2.0 1.8–5.0 V RTS, CTS, DTR, DSR Commonly used, EEPROM-configurable
CP2102/CQ1 Silicon Labs Full-Speed USB 2.0 3.3 V, 5 V RTS, CTS Low-cost, integrated EEPROM
PL2303HX Prolific Full-Speed USB 2.0 5 V RTS, CTS Widely cloned; watch for fake chips
CH340G WCH Full-Speed USB 2.0 3.3 V, 5 V RTS, CTS Very cheap; extremely reliable with good support
CP2104 Silicon Labs Full-Speed USB 2.0 1.8–5.0 V RTS, CTS, DTR Newer silicon with lower power

Signal Levels & Pinouts

TTL vs RS-232

  • TTL-Level UART: Logic-level serial at 0 V–VCC (3.3 V or 5 V). Used on microcontrollers and SoCs.
  • RS-232: ±3 V to ±15 V swings with inverted logic. Requires level-shifter (MAX232) beyond TTL.
TTL Signal Pin Description
VCC VCC Adapter power output (3.3 V/5 V selectable)
GND GND Ground reference
TXD TxD Transmit data (adapter⇒target)
RXD RxD Receive data (target⇒adapter)
RTS RTS Request to Send (toggle for hardware flow)
CTS CTS Clear to Send

Connectors & Cabling

  • 0.1″ 6-Pin Header: Typical breakout boards; pin order varies—check silkscreen (“GND, CTS, VCC, TXD, RXD, RTS” common).
  • DB9 Male/Female: Full-sized RS-232 adapters; DB9 pinout per TIA/EIA-232-F standard.
  • Inline Cables: Must verify pin-color mapping (e.g. black=GND, red=VCC, orange=TX, yellow=RX).

Drivers & Host Configuration

Most USB-UART ICs require vendor drivers:

  • FTDI: Native on Windows/macOS/Linux but may need VCP drivers from FTDI website.
  • CP210x: Silicon Labs provides VCP drivers; Linux kernel has built-in support (cp210x).
  • CH340: Linux requires ch341 module; Windows installer from WCH.
  • PL2303: Windows driver from Prolific; beware counterfeit devices with wrong PID.

After installation, adapters appear as:

  • Windows: COMx (e.g. COM3, COM4)
  • Linux/macOS: /dev/ttyUSBx, /dev/tty.SLAB_USBtoUART, /dev/cu.usbserial-XXXXX

Practical Usage

Console & Bootloader Access

  1. Connect GND first to establish common reference.
  2. Wire TX↔RX (cross): adapter TX ⇒ device RX; adapter RX ⇒ device TX.
  3. Power: Some boards can be powered via adapter VCC, but prefer separate regulated supply.
  4. Open Terminal: screen /dev/ttyUSB0 115200,8N1 or minicom -D /dev/ttyUSB0 -b 115200.
  5. Reset Sequences: Use DTR/RTS toggles for automatic reset into bootloader (e.g. Arduino auto-upload).

Firmware Flashing & Modding

  • UART Bootloaders: Many MCUs (STM32, ESP32) include UART ROM bootloader—hold BOOT0, toggle reset.
  • Protocol Tools: stm32flash, esptool.py, flashrom over serial protocols.
  • Voltage Translation: When target uses 1.8 V logic, add a bidirectional level shifter (e.g. TXB0108).

Troubleshooting & Advanced Hacks

  • Baud Rate Mismatch: Check both sides match—common rates: 9600, 115200, 921600 bps.
  • Flow-Control Issues: Disable hardware flow in software if CTS/RTS not used or miswired.
  • Buffer Latency: FT232 chips allow latency timer tuning via EEPROM (ftdi_eeprom on Linux).
  • Counterfeit Detection: Genuine FTDI chips enumerate as “FT232R USB UART”; fakes may require VCP patch.
  • Solder-Mod Kits: Add solder-jumper pads to switch voltage level or enable 1.8 V rail.
  • Signal Integrity: Keep wiring <10 cm; add series 27 Ω resistors on TX lines to reduce overshoot.

Best Practices

  • Always verify GND continuity before powering.
  • Use ESD protection when probing exposed pads.
  • Avoid back-feeding USB port power—disconnect VCC if powering target separately.
  • Label and document pin mapping on custom adapters.

References & Further Reading

  • FTDI Application Notes (AN_230, AN_232R-05)
  • Silicon Labs CP210x Data Sheet
  • WCH CH340 Datasheet
  • “Serial Port Complete” by Jan Axelson