USB-to-Serial adapters: Difference between revisions
DRSDavidSoft (talk | contribs) (Added initial page) |
DRSDavidSoft (talk | contribs) m (updated note about CH340G) |
||
Line 22: | Line 22: | ||
| PL2303HX || Prolific || Full-Speed USB 2.0 || 5 V || RTS, CTS || Widely cloned; watch for fake chips | | 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; | | 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 |
Revision as of 11:55, 15 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 |
---|---|---|---|---|---|
FT232R | FTDI | Full-Speed USB 2.0 | 1.8–5.0 V | RTS, CTS, DTR, DSR | Gold-standard, 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