This is an old revision of the document!
Table of Contents
Nanjing QinHeng Electronics CH340
These are cheap USB UARTs available is various configurations.
These devices are becoming popular, so much so that fake ch340 chips exist. The fakes have the ch340 USB identity and can be found in RS485 adatpers (see below).
As well as being found on general purpose serial interfaces they are often found on Arduino clones and ESP8266 bridges.
Pinout
CH340G CH340T CH340R +------+ +------+ +------+ GND 1 16 VCC CKO 1 20 NOS# NC 1 20 NOS# TXD 2 15 R232 ACT# 2 19 VCC ACT# 2 19 VCC RXD 3 14 RTS# TXD 3 18 R232 TXD 3 18 R232 V3 4 13 DTR# RXD 4 17 NC RXD 4 17 IR# VD+ 5 12 DCD# V3 5 16 RTS# V3 5 16 RTS# VD- 6 11 RI# VD+ 6 15 DTR# VD+ 6 15 DTR# XI 7 10 DSR# VD- 7 14 DCD# VD- 7 14 DCD# XO 8 9 CTS# GND 8 13 RI# GND 8 13 RI# +------+ XI 9 12 DSR# XI 9 12 DSR# XO 10 11 CTS# XO 10 11 CTS# +------+ +------+
Linux
Identity
ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
udev /dev/ttyCH340
KERNEL=="ttyUSB*",\ ATTRS{idVendor}=="1a86",\ ATTRS{idProduct}=="7523",\ GROUP="dialout",\ MODE="0660",\ RUN+="/bin/ln -sf %k /dev/ttyCH340"
udev by-id
/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
udev by-id is not supported by Pickle Microchip PIC ICSP.
Pickle Microchip PIC ICSP
Pickle Microchip ISCP can be used with a ch340 USB UART to drive a board such as the Velleman K8048 kit which has an RS232 interface.
Velleman K8048 Configuration
Programming using a USB UART is a slow process but should be reliable.
Here is a tested .pickle configuration.
DEVICE=/dev/ttyUSB0 SLEEP=600 BITRULES=0x001F
The SLEEP value above impacts both speed and reliability. This value can be fine tuned.
RS485
Cheap RS485 adapters exist using both this chip and a fake version of this chip.
The real chip is a CH340G with 16 pins and the fake chip has 24 pins in an unmarked package. The top 20 pins of the fake match those of a genuine CH340R or CH340T device which is only available as a 20-pin SSOP.
The RS485 I/O stage varies slightly between the real and fake adapters and is constructed like this for the CH340G device.