CH340

From UART Wiki
Revision as of 15:12, 15 May 2025 by DRSDavidSoft (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
CH340G USB-to-Serial adapter – a common breakout module

CH340G USB-to-Serial Adapter

The CH340G is a low-cost USB-to-Serial (UART) bridge chip developed by WCH (Nanjing QinHeng Microelectronics). It enables communication between USB-equipped computers and devices with UART interfaces, such as embedded systems and microcontrollers. Widely used in development boards like Arduino clones, the CH340G is favored for its affordability and reliability.

Features

  • 🔌 USB 2.0 Full-Speed Interface: Supports data transfer rates up to 12 Mbps.
  • Voltage Compatibility: Operates at both 3.3V and 5V (configurable), accommodating various logic levels.
  • 🧰 Minimal External Components: Requires only a crystal oscillator and a few capacitors for operation.
  • 💾 Driver Support: Compatible with Windows, macOS, and Linux operating systems.
  • 🔄 Standard UART Interface: Provides TXD, RXD, RTS, and CTS signals for serial communication.
  • 🧱 Compact Package: Available in SOP-16 package, suitable for space-constrained applications.

Breakout Module

The CH340G breakout module is a compact USB-to-UART board that exposes serial data and power pins for interfacing with microcontrollers and other TTL-level serial devices. It is commonly used for flashing firmware, serial debugging, and modding embedded devices. An open-source variant has been developed that focuses on ease of use and assembly.

Pin Description

Pin Label Function Notes
GND Ground Common reference; connect first
TXD Transmit Data Serial output from adapter (connect to target RX)
RXD Receive Data Serial input to adapter (connect to target TX)
+3V3 Regulated 3.3V Output Low current (≈50 mA); from onboard LDO regulator
VCC Logic Supply Typically 3.3V or 5V selectable via jumper
+5V USB Power Output Direct 5V from USB port; can power external device

Voltage Selection Tips

  • Modules usually feature a jumper or solder bridge to select logic level (VCC) as 3.3V or 5V.
  • To avoid damaging 3.3V logic devices, confirm the jumper position or measure VCC before connecting.
  • The +5V pin always outputs USB power (5V), regardless of logic level selected.

Wiring Instructions

  • 1. Connect GND first to establish a shared ground reference.
  • 2. Cross TX and RX: Adapter TXD → Device RX, Adapter RXD ← Device TX.
  • 3. Confirm logic voltage: Use VCC pin to power target only if voltage matches.
  • 4. Avoid backfeeding: If powering the target separately, leave +5V and +3V3 unconnected.

⚠️ Tip: Mark pin labels clearly or use colored Dupont wires to prevent reversed connections during prototyping.

Chip Pinout

Pin Number Name Description
1 VCC Power supply input (3.3V or 5V)
2 GND Ground
3 TXD Transmit data output
4 RXD Receive data input
5 RTS Request to send output
6 CTS Clear to send input
7 DTR Data terminal ready output
8 DSR Data set ready input
9 RI Ring indicator input
10 DCD Data carrier detect input
11 XI Crystal oscillator input
12 XO Crystal oscillator output
13 UD+ USB D+ signal
14 UD- USB D- signal
15 RESET Reset input
16 NC No connection

Applications

  • 🛠️ Firmware Uploading: Used to program microcontrollers via UART bootloaders.
  • 🖥️ Serial Debugging: Facilitates communication with serial consoles for debugging purposes.
  • 🔧 Device Modding: Enables interfacing with UART ports on various hardware for customization.
  • 📡 Sensor Data Logging: Collects data from serial-output sensors for analysis.

Driver Installation

  • Windows: Requires installation of the CH340 driver from the manufacturer's website.
  • macOS: Compatible with macOS 10.9 and later; driver installation may be necessary.
  • Linux: Supported natively by most distributions; the `ch341` kernel module handles the device.

Troubleshooting Tips

  • 🔌 Connection Issues: Ensure correct wiring of TXD and RXD lines; they should be cross-connected.
  • ⚠️ Driver Conflicts: Uninstall conflicting drivers that may interfere with CH340G operation.
  • 🔁 Loopback Test: Short TXD and RXD to test the adapter's functionality by checking for echoed data.

External Resources