Silabs CP2104 USB UART modules
Posted at 2015-04-27.
There are several Silabs CP21xx based modules available from Chinese shops. I think these work far better than Prolific based modules and far cheaper than FTDI. CP2104 seems to be the nicest one around.
I bought a bag of these. They are practically cheap enough to leave in projects or bag with prewired cables for certain devices. A five-pin cable is included (separate pins).
There are pins on board for
5V (via resistor from USB),
(chip contains a regulator),
TxD/RxD, and ground.
There are also holes labeled
Most names match EIA-232 signals.
SPD/ Seem to connect to
It looks like
DTR has a series cap.
According to the datasheet,
TxD should indeed transmit and
receive data as it should be.
Sometimes the pins are labeled backwards probably to indicate what they
should be connected to.
This may even lead to broken parts as some chips can't handle their
transmit pins being pulled up/down by other circuits.
Tracing the board, it seems these are taken to pins with matching
Looking at the
TxD pin with a scope should confirm this.
Some projets (microcontrollers) would also be happier with
and many modules use
On CP2104, connection to the
Vio pin (5) determines the voltage.
The connection is not quite visible on the boards, but
Vdd seems very
Only 5V connection to the chip seems to be going to the
Measuring the pin and
TxD or handshake signals should confirm this.
Update: These seem to work well as Propeller programmer/interface.
usb 2-1.2: new full-speed USB device number 10 using ehci-pci usb 2-1.2: New USB device found, idVendor=10c4, idProduct=ea60 usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1.2: Product: CP2104 USB to UART Bridge Controller usb 2-1.2: Manufacturer: Silicon Labs usb 2-1.2: SerialNumber: 00BE674B usbcore: registered new interface driver usbserial usbcore: registered new interface driver usbserial_generic usbserial: USB Serial support registered for generic usbcore: registered new interface driver cp210x usbserial: USB Serial support registered for cp210x cp210x 2-1.2:1.0: cp210x converter detected usb 2-1.2: reset full-speed USB device number 10 using ehci-pci usb 2-1.2: cp210x converter now attached to ttyUSB0
Works out of the box on Debian Jessie (amd64), and probably every other GPOS out there. It's easy enough to use udev rules to set device name and permissions if you like.
picocom does send a low pulse to
Disconnecting sends a high pulse to
So, the actual
DTR seems to idle high and go low on connect and there
is indeed a series cap.
Sending data does cause
TxD to pulse down from
3.3 V (or so) and
RxD seems to generate noise characters in the tty.
Sending a break (
picocom) will be a distinct blip.
I poked around with
pyserial as well.
Getter functions show changes when pulling down pins, as they should.
Setters toggle pins (or pulse
% ipython3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) Type "copyright", "credits" or "license" for more information. IPython 2.3.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In : import serial In : s = serial.Serial('/dev/ttyUSB0') In : s.read() # Listen to noise Out: b'\xff' In : s.getDSR() Out: False In : s.getDSR() # Data Set Ready Out: True In : s.getDSR() Out: False In : s.getRI() # Ring indicator Out: True In : s.getRI() Out: False In : s.getCD() # DCD is Data Carrier Detect Out: True In : s.getCD() Out: False In : s.setRTS(True) In : s.setRTS(False) In : s.setDTR(True) In : s.setDTR(False) In : s.write(b'asdfasdfasdfasdf') Out: 16
Looking around Linux 3.16 cp210x.c, it says 2104 should try to clock to requested rates. Feeding 31250 to the formulas gives an exact 31250 back, so it looks like this thing could actually talk MIDI. (See datasheet section 6.1.)
There seem to have been some efforts to get GPIO support in, but I don't think anyone has made it in clearly. This kind of mixed device is a bit odd, of course.