Quick Bits Resources

Isolated USB Serial Bridge

Written by Andrew Levido

When developing, debugging and testing embedded projects it can be really handy to have a serial port that you can use to print diagnostic messages or data dumps, or use to create a simple command line interface to your firmware. This is something I include in almost all of my microcontroller (MCU)-based projects unless there is a really good reason why not. Most MCUs have a spare UART you can use for this purpose, and you only need two pins, so it is a no-brainer, especially at the prototype stage.

Of course, the MCU produces only logic-level asynchronous TX and RX signals, so some kind of interface is necessary to get them to work with your terminal software. In the olden days we would use a level translator to provide RS232-level signals and connect to the device running our terminal emulation software via a DB-9 serial cable. Getting a reliable connection was always a bit of a rigmarole involving null modem cables, RS232 break-out boxes and sometimes soldering jumpers between DSR & DTR and RTS & CTS pins.

Thankfully, that is no longer because today USB is the only way to go.  Many manufactures make USB-UART interface chips that seamlessly convert logic level serial signals to USB. Most use the USB Communications Device Class (CDC) which appears as a virtual COM port on the host. It is then simply a matter of configuring your terminal emulator to use this COM port, setting the communications parameters and you are away.

For no particular reason I have used the Microchip MCP2200 in this role in quite a number of my projects and it works well. Figure 1 shows the block diagram of this device extracted from its datasheet. In addition to the USB serial capability, this chip provides 256 bytes of user EEPROM and general purpose I/O.

CLICK TO ENLARGE
FIGURE 1. The MCP2200 from Microchip includes 256 bytes of user EEPROM and 8 configurable GPIO pins. Similar chips are available from a variety of manufacturers.

You can connect this type of chip directly to your MCU’s TX and RX pins and that will certainly work fine. However, there are a few reasons why you might want to consider isolating the diagnostic port. An obvious one is if your circuit in not ground-referenced or there is any possibility that high voltages may find their way onto the logic power supply under fault conditions. It is heartbreaking enough to blow up your circuit, but much worse if you blow up your laptop or PC at the same time. A more subtle reason for isolation includes the avoidance of ground loops or limiting the conduction of noise from your computer’s power supply into your circuit—especially if you are dealing with precision measurements.

So, how do we isolate the USB-UART interface? The answer is to use one of the low-cost digital isolators such as the Silicon Labs Si8422. This neat chip provides up to 2.5kV isolation and one digital channel each way capable of 150Mbps, all for about $1.50 (US) in unit quantity. Other configurations and packages are available, including larger packages with 5kV isolation. These chips work by capacitively coupling a modulated digital signal across the isolation barrier as shown in Figure 2. A demodulator on the other side restores the signal.

— ADVERTISMENT—

Advertise Here

FIGURE 2. The Si8422 Digital Isolator from Silicon Labs works by modulating the input signal at a very high frequency, coupling it capacitively across the isolation barrier and demodulating it to recovering the signal on the other side.

Figure 3 shows the complete circuit as implemented in a recent project of mine. The isolated side is powered from the USB bus via a 3.3V regulator. The TX and RX led indicators are optional. The two 33 Ω resistors provide a degree of protection on the D+ and D- pins.

CLICK TO ENLARGE
FIGURE 3. An example of a complete isolated USB UART bridge taken from a recent project. Pins 6 and 7 of U16 connect directly to the microcontroller’s TXD and RXD pins respectively.

In researching this article, I came across another USB-UART bridge from the same vendor as the isolator. This one, the CP2120, looks very interesting as it does not require an external crystal and incorporates a voltage regulator on-board. I have not tried this, but it looks like it could considerably reduce the parts count and (already low) cost. It is definitely on my list for next time.

As a final note, you need to be careful leaving an exposed serial port on your device when it gets out in the wild as it presents a serious security vulnerability. You might want to make sure it is disabled in your production code.

References

“Digital Isolators – Silicon Labs.” Accessed November 27, 2020.
https://www.silabs.com/isolation/digital-isolators

“MCP2200 – USB – USB Bridge.” Accessed November 27, 2020.
https://www.microchip.com/wwwproducts/en/en546923

“USBXpress USB Connectivity Bridges – Silicon Labs.” Accessed November 27, 2020.
https://www.silabs.com/interface/usb-bridges

Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.


Note: We’ve made the May 2020 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

— ADVERTISMENT—

Advertise Here

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

+ posts

Andrew Levido (andrew.levido@gmail.com) earned a bachelor’s degree in Electrical Engineering in Sydney, Australia, in 1986. He worked for several years in R&D for power electronics and telecommunication companies before moving into management roles. Andrew has maintained a hands-on interest in electronics, particularly embedded systems, power electronics, and control theory in his free time. Over the years he has written a number of articles for various electronics publications and occasionally provides consulting services as time allows.

Sponsor this Article

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2021 KCK Media Corp.

Isolated USB Serial Bridge

by Circuit Cellar Staff time to read: 3 min