RoadTest: SILICON LABS USB-TO-UART Bridge Controller EVM
Author: shabaz
Creation date:
Evaluation Type: Evaluation Boards
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Multiple vendor parts explored here: https://www.element14.com/community/groups/open-source-hardware/blog/2016/02/01/implementing-non-ftdi-usb-to-uart-serial-interfaces
What were the biggest problems encountered?: No major issues experienced. Improvements could be made in several areas, and there are a few cosmetic bugs in the software too. However, overall the product functioned well and it was not difficult to make good use of the functionality. I think the documentation is very good, but software bundles are poorly organized on the website, the user is likely to download outdated code or not find the code they are seeking unless they really know what they are searching for; for this reason a couple of points were knocked off for Support materials in the scoring.
Detailed Review:
The CP2102N USBXpress USB-UART Bridge is a USB-to-UART converter chip that I was keen to try out. I wanted to use it for applications that require USB power beyond 500mA, and also for experimenting with a MIDI keyboard.
There are many USB-to-UART chips available (see Implementing Non-FTDI USB-to-UART Serial Interfaces for a comparison table for some of them) and they all have their benefits and disadvantages. The USBXpress range from Silicon Labs is designed to be easy to integrate into applications with easy-to-use drivers. Silicon Labs has a very diverse range of products including some very interesting microcontrollers, wireless and sensors products (their Sensor PuckSensor Puck is awesome), so I was hopeful that this USB-UART Eval kit product would be competent and worth trying out too. In the past I have used Microchip's MCP2221 which I like a lot because it is available in easy-to-solder packages (including a through-hole version) and is easy-to-use, however its feature-set is quite basic.
The CP2102N offers some great features like the ability to draw higher current from the USB port when required, in order to charge batteries for example. I was also keen to find a part that was suited for 3.3V interfacing; the MCP2221 cannot do this without an external 3.3V regulator. 1.8V interfacing capability would be handy too for future compatibility. So, I looked forward to examining this part.
The CP2102N integrated circuit comes in three different packages: 20-pin20-pin, 24-pin24-pin and 28-pin28-pin. The parts are designed to be compatible with some previous generation parts by Silicon Labs, so if a design is already using an older part then it is likely that it will work with the CP2102N with zero or little modification depending on the particular part. The older CP210x 'Classic' non-N-suffix products were workhorses, seen in many products over the years.
The CP2102N-MINIEK evaluation kitCP2102N-MINIEK evaluation kit consists of the 28-pin variant on a small PCB module with SIL pin headers already attached, and it comes plugged on some foam-board with the pinout marked which is very handy.
The CP2102N has connections that can be used as general purpose input/output pins. This can be useful for out-of-band control of hardware where it is not feasible to send commands over the UART. An example use-case could be to use the GPIO to switch connections from one microprocessor to another, in a multi-processor project. The same USB-UART chip could therefore be used to control several components, one-at-a-time. Another use-case could be to use a GPIO pin to perform a reset of attached hardware if it is not responding, or to force attached hardware into a ‘bootloader’ mode for firmware updates. The GPIO capability when configured for output can function in an open drain or a push-pull mode. The GPIO capability is explored in more detail further below.
There is an application called USBXpress Configurator which is used to configure the various features of the CP2102N. It offers the ability to configure these things:
There are lots of settings. To get the tool, download Simplicity Studio which is the Integrated Development Environment (IDE) for all Silicon Labs devices. When prompted, select the ‘cp2102n-miniek’ kit. Next, click File->New->Project and in the New Project Wizard choose ‘Xpress Configurator Project’ and in the ‘Part’ selection drop-down select CP2102N-A01-GQFN28 which is the full part number of the device on the CP2102N-Mini board. How to use the tool is described in a Silicon Labs document called AN721, but it is fairly self-explanatory. Set the desired values using the entry boxes/check-buttons, and then click on ‘Program to Device’ at the bottom of the window as shown in green in the screenshot below. If you wish to import in the values from the device first, click on ‘Import from Device’ which is alongside it. During the Import or Program stage there is status information, but at first glance it wasn’t easy to find. Basically you have to click on the red circled item at the bottom-right of the screenshot and that exposes the Status pane.
To try out the GPIO from Windows, Visual Studio 2017 was used. There is a Community Edition which is free. After it is installed, in the Start Menu click on ‘Visual Studio Installer’ and then click Update and then select Visual Studio Community 2017 Update when the selection appears. Visual Studio 2017 has its bugs and so the update is necessary.
Code in a bundle named ‘AN223SW’ was downloaded from the Silicon Labs website. It contains a software example called CP210xPortReadWriteExample which was unzipped. Two days later, when writing up the review, I struggled to find the code on the Silicon Labs website. If you wish to obtain the entire code bundle it is recommended to download the USBXpressHostSDK from the Silicon Labs Interface Software Downloads page under the heading Interface Software Development Kit Packages, and it also contains the example code referred to here (the AN223SW code URL was later re-discovered from the Community site, but I think Silicon Labs should delete it and direct people to the full bundle).
In Visual Studio click on File->Open Project/Solution and then select the CP210xPortReadWriteExample.sln file. If prompted, click on ‘Install’ to install any missing features in Visual Studio (the code was originally written in an earlier version of Visual C++). Next, right-click on ‘Solution CP210xPortReadWrite’ in the Solution Explorer pane on the left side, and select ‘Retarget Solution’. Then right-click on the project name (CP210xPortReadWrite) in the Solutions Explorer and select Properties. In the section titled ‘General’, search for Windows SDK Version and change from 8.1 to the latest in the drop-down selection box (it was version 10.0.15063.0 for me) and click on ‘OK’. Next, just under the menu bar in Visual Studio, change the build from win32 to x64.
When the code is built, it will not run because the Debug folder CP210xPortReadWriteExample_SRC\x64\Debug is missing the DLL. Copy CP210xRuntime.dll into that folder from the Release folder CP210xPortReadWriteExample_SRC\x64\Release and then re-build the code.
When run, if you get an error when clicking on the Read button due to a bug in the DLL, obtain this fixed file from the Silicon Labs community site and copy CP210xRuntime.dll into the Debug and Release folders (do not copy the .lib file, it seems to have inconsistencies with the DLL file).
Now if you rebuild the solution, the code should function!
The code is quite simple, CreateFile is executed with the COM port number, and then from the API the functions CP210xRT_WriteLatch and CP210xRT_ReadLatch are called to write or read values respectively. The code is self-explanatory but there is also API documentation in the AN223 document on the Silicon Labs website.
This was not attempted, because currently the code is quite old and needs to be merged with the latest changes to the CP2102N driver code. Today this is left as an exercise for the user. I am guessing there has been low demand so far to use the GPIO capability with Linux. For anyone who wants to perform this exercise, see ‘Linux_3.x.x_VCP_Driver_Source’ on the Silicon Labs website. The code there will need to be merged with the Linux source code cp210x.c that will be part of the kernel source code in Linux.
Many portable devices with built-in batteries can be charged nowadays using USB ports. This of course includes mobile phones and tablet, rechargeable mice and so on. There are also many devices that derive quite large amounts of power even if they don’t have an internal battery. Examples would be USB storage drives, TV sticks like Amazon Fire Stick, USB speakers and novelty items like USB lights and coffee warmers. Over the years, both non-standard and standards-based methods have been devised to be able to deliver power via USB for either charging a battery or for powering a device (or both). It is not as straightforward as just plugging a device into a mains socket. The USB power delivery is often negotiated, because it cannot be assumed that the power source has sufficient capability to power the load. As an example, old USB chargers only support up to 500mA of current at 5V; this is insufficient to charge a modern phone or tablet in any reasonable amount of time because the battery capacity in modern phones and tablets is far higher than in the past. This will matter more and more as the power capability and requirement increases in products.
Four of the main methods are described here. Some are non-standard, and some are standards-based.
The CP2102N offers a really simple way of integrating to a battery charger circuit; there are three pins which go high; if all three are high then up to 1.5A can be drawn by the charging circuit. If just two are high then up to 500mA is available. If just one is high then only up to 100mA should be drawn. Typically these pins would be used to drive MOSFETs that are used to program the set-current of the charger IC. For an example circuit, see the LTC4064 battery charger IC datasheet figure 2; a MOSFET and resistor is used to switch the charge current from a low value to a higher value.
By default the CP2102N has the charge negotiation capability disabled; I ran the USBXpress Configuraton and enabled it, and set the three pins (they are called CHREN, CHR0 and CHR1) to be push/pull outputs instead of open drain. Next, I connected them up to an oscilloscope and then plugged the USB cable into the PC and various chargers! The results were interesting. For all of the 'scope traces below, the yellow trace is the CHREN signal, blue is CHR0 and purple is CHR1.
The traces below shows the three signals when plugged into a charger called Sandstrom SDLUSB12 which has dual outputs, each individually rated for 5V 2.1A. As can be seen, when the USB connection was made the three signals briefly went high for about half a second, and then they all dropped down. This means that the charger is not BCS 1.2 compliant. Some devices will not fast-charge with this charger as a result. It was purchased several years ago, when the standard would have been pretty new.
Next I tried a couple of Samsung phone chargers, models EP-TA11UWE and EP-TA20UWE. The former is rated at 5.3V 2A, and the latter is rated at 5V 2A but can switch to 9V 1.67A (known as Samsung Adaptive Fast Charging). When I plugged the CP2102N board into the chargers, this was the output on the three charge pins (both chargers behaved the same):
The result shows that the CP2012N successfully identified that it was connected to a charger that was BCS 1.2 compliant and could support high current loads.
Laptop ports can have differing behaviour. Sometimes not all USB ports on a laptop can support high current capability. The ports on the side of a Lenovo P50 laptop and on the side of a Microsoft Surface Book exhibited this behaviour:
This shows that the ports supported up to 500mA current draw capability. One rear USB port on the Lenovo laptop is marked with a battery icon, and is intended for charging mobile phones. When I tested that port, it behaved like the Samsung chargers. The Surface Book has a USB port on the mains power brick; that too behaved like the Samsung chargers.
It would be odd not to try out the USB-Serial capability of the USB-Serial chip! : ) I liked the broad range of baud rates that are supported. Some popular ones can be configured to be supported by the CP2102N using the configurator tool, but by default arbitrary baud rates are supported too although there could be a percentage error if some unusual values are set (there is a formula for calculating error in the data sheet, and it states that in most cases the error will be under 1%). I wanted to see if the MIDI baud rate was supported, because this is a slightly unusual baud rate (31250 baud). I set it to 31250 baud using my terminal software (SecureCRT) and then connected the Tx pin to an oscilloscope to confirm if it really did result in the correct baud rate and if I was able to decipher which key-presses I was issuing from the terminal software. I decided to wire it to a music keyboard (Korg X5D). Using a circuit broadly similar to the one in the MIDI specification, I connected it to the keyboard’s MIDI IN port and then use the terminal software (I used ‘Termite’ which has the ability to send and display the bytes in hexadecimal) and then sent the following 3-byte message from my PC to the music keyboard (i.e. to operate it as a synthesizer): 0x90 0x3c 0x7f which means “note on, channel 1, music note C, high velocity keystrike”. It correctly caused the music keyboard to play a note. Unfortunately I couldn’t test in the other direction (i.e. using the music keyboard to generate MIDI data) because it appears my keyboard has a fault in that direction : ( One day I will open it up and repair it. Anyway, the test had confirmed that the CP2102N could successfully function at such a baud rate and interface with a music keyboard.
Examining the CP2102N further, It is good to see that all the flow control and Modem-style handshake signals are present on the CP2102N. They are not multiplexed with GPIO functions, so they are always available.
Another great feature is RS485 driver compatibility. When attaching an RS485 driver to the CP2102N, since the protocol allows for multiple devices on the RS485 bus, there is a need to be able to disable the output driver when not transmitting on the bus. The CP2102N supports this capability. There is a special dedicated output pin for this (configurable using the USBXpress Configurator tool). As examples, compatible RS485 driver chips could be the ADM483ADM483 RS485 transceiver IC from Analog Devices. or MAX485MAX485 from Maxim.
There are some things to be aware of when deciding how to integrate the CP2102N into designs:
Firstly, if you need the UART logic level signals to be at anything other than 3.3V levels, then the 24-pin package device needs to be used because it has a separate 'VIO' pin for setting the I/O voltage. The part on the evaluation board has 28 pins and so it has no I/O setting pin. Internally all variants of the CP2102N function at 3.3V, and there is an internal voltage regulator that takes the 5V from the USB connector and converts to 3.3V. With the non-24-pin variants, the I/O voltage is wired to 3.3V internally and cannot be adjusted.
Furthermore, without external logic level translation circuity, the CP2102N is not designed for legacy 5V logic-level operation. It is suitable for operation at logic levels of 3.6V or lower with the 24 pin variant, and only at 3.3V logic levels with the 20 and 28 pin variants.
Personally I would have liked to see 5V tolerance on the input pin, so that it could be compatible with microcontrollers operating at 5V.
(NOTE: See the comments section for more detail, but Silicon Labs have replied that the CP2102N is 5V tolerant provided that the device is powered up prior to the 5V being applied, and they have provided a solution for the cases where 5V may be applied before the device is powered up. This is discussed in the comments below).
The CP2102N requires protection against ESD on the USB connections. This can be achieved with a single part, a TVS diode arrayTVS diode array as recommended in the datasheet and used on the evaluation kit. Competitor parts are often rated to at least 2kV on these pins, so it is interesting that the CP2102N requires this to be an additional part. However, I can see why they implemented things this way; the additional part is cheap and offers up to 30kV of ESD protection whereas competitor USB-UART chips with integrated ESD protection do not reach this level.
(NOTE: Silicons Labs has replied to this and state that the CP2102N does have ESD protection, which is great. However, they say that although it supports 8kV in the Human Body Model test, when inserting/removing the USB connector it can experience higher levels of ESD. So, they recommend the TVS diode array to be used).
The CP2102N is an interesting device. It has some excellent features like the battery charge negotiation capability. As a modern device it supports fairly high speed baud rates (up to 3Mbaud) which should suit most use-cases, and the flow control pins will help here. The software was straightforward to work with for configuring the device and for viewing the current configuration. It is also great that Silicon Labs will provide a free PID value for customers to use in their products that use Silicon Labs USB parts. The RS485 driver interfacing capability and the ability to configure arbitrary baud rates was excellent to see. I also liked that the device needs no external voltage regulator to use at the most popular logic level (3.3V logic) and that the GPIO was configurable for open drain or totem pole (push/pull) for good flexibility.
There are also some additional minor features that were not explored but could be compelling for some, such as built-in oscillator output capability. It could be handy to clock a microcontroller that may ordinarily use a crystal (the clock is derived from an internal oscillator that is accurate to +-0.25%).
In summary I am happy that I now have experienced a USB-UART chip which is easy-to-use and has a lot of useful functionality. I'm looking forward to using it often in designs.
Top Comments
Since the review, I've noticed a couple of interesting things that could make the CP2102N even more interesting than it already is.
Firstly, one of the test reports on the Silicon Labs website seems…
... another option for your oscilloscope programming issue, John.
Hi Shabaz,
Thank you for the informative and thorough review of the CP2102. I always learn something new when I read your posts.
John