CH340 USB to Serial Converter IC
The CH340 is a popular IC that is a bidirectional USB to Serial converter IC, used to convert USB signals into UART, which can be used to communicate with microcontrollers. This IC is found in some versions of the Arduino Nano to perform Serial to USB conversion to communicate with the board through a USB connector. This article will focus on the CH340T variant of the IC, which is used for UART to USB conversion.
CH340 Pinout Configuration
Pin Number |
Pin Name |
Description |
1 |
CKO |
Clock output |
2 |
ACT |
Negative phase clock output |
3 |
TXD |
Serial data output |
4 |
RXD |
Serial data input |
5 |
V3 |
External 3.3V supply |
6 |
UD+ |
USB data positive |
7 |
UD- |
USB data negative |
8 |
GND |
IC ground reference |
9 |
XI |
External crystal pin |
10 |
XO |
External crystal pin |
11 |
CTS |
Clear to send signal pin |
12 |
DSR |
Data set ready pin |
13 |
RI |
Ring indicator pin |
14 |
DCD |
Data carrier detect pin |
15 |
DTR |
Data terminal ready pin |
16 |
RTS |
Request to send pin |
17 |
NC |
Not connected |
18 |
R232 |
RS232 enable |
19 |
VCC |
Power input |
20 |
NOS |
Forbid USB device suspending pin |
Features & Specifications
- Full speed USB 2.0
- Emulates standard serial interface, can be used to upgrade older equipment to USB
- Baud rate from 50bps to 2Mbps
- 5V and 3.3V power
- SSOP-20 package
Note: Complete technical details can be found in the CH340 datasheet linked at the end of this page.
CH340 Equivalents
FT232, CH340G
Other USB To Serial ICs
CH341, FT232
How To Use CH340 USB To Serial Converter IC
The CH340 is an easy-to-use USB to serial IC that converts USB signals to UART, which is used to communicate with microcontrollers and older appliances.
One of the most common applications of this chip is in various Arduino and Arduino-compatible boards, since the ATMega329P used does not have built-in USB support, it talks to a computer using a UART interface that is converted to USB using the CH340.
Shown in the above figure is the ATMega328P microcontroller and the CH340 connected together to provide a USB interface.
The TX and RX serial pins are connected to pins PD0 and PD1 of the microcontroller respectively, providing the data connections on the UART side. Another interesting thing to note is that the DTR pin is connected through a capacitor to the reset pin, which resets the microcontroller every time a serial connection is established or the USB connector is plugged in. On the USB side, the D+ and D- pins are connected to the respective pins on the USB connector. A 12MHz crystal is also connected (along with its load capacitors) to provide a USB clock. With this simple circuit configuration, the CH340 can be used as a simple USB to the serial interface.
Applications
- USB to UART conversion
- Upgrading old devices to USB
- Programming microcontrollers