How to Design a PCB With a Serial Port Interface
When you want to access your embedded system and send commands to a microcontroller via your computer, you don't need to be a pro software developer. Controllers, SoCs, application processors, and FPGAs will include serial interfaces that can be used to query and control the chip. Aside from FPGAs, these interfaces are built into the chip and they only require a few on-board components to access.
The simplest serial interface to use to query a processor is a UART interface. The UART interface can be accessed from your computer via a USB cable, but doing this requires a USB to serial bridge controller. These chips are very easy to use, and some of them are plug-and-play parts with standard operating systems. If you want to add this functionality to your embedded systems PCB, here is how you do it.
Two Ways to Get USB Access to Your Board
Implementing a serial port interface into your embedded system is simple, but it is not always a direct connection between a USB port and your microcontroller. Unless there is a driver for your microcontroller that supports the direct USB connection to your computer, you will need to use a USB to serial bridge connected to the serial interface on your chip.
Technically, SPI or UART are the standard interfaces used for this functionality, as SPI is commonly used by programmer modules to flash a binary into memory. The simplest way to do this is with UART. A UART interface is a simple two-wire bidirectional interface operating at standard logic levels. To gain access to your serial UART port via USB, you have two options:
-
Use a USB to serial converter module, and connect flying leads from the module to your custom PCB
-
Place a USB to serial bridge IC on your custom PCB, and wire the USB side to a USB port
Both topologies are shown below.
The first option is simple, and you can buy USB to serial converter modules from online retailers. You will have to use flying leads to access your custom PCB over USB, which is not useful in a production environment. For a production-grade embedded system, you will want to include the USB port and the serial bridge IC on your custom PCB.
How to Use a Bridge IC
Serial port bridge ICs are available from many vendors and they are an inexpensive line item on a BOM. If you want to include a feature where your device can interface with a computer application via USB, then this feature is mandatory either as a driver in your binary or a separate IC. Popular manufacturers of these components include Infineon, SiliconLabs, and FTDI.
The block diagram below shows a typical serial bridge IC. These ICs can accept 5 V input as the main power source, which allows them to pull power through the USB port. Some of these will also include an integrated 3.3 V fixed LDO so that they can supply power to other chips in the device. This would typically be the approach taken with a USB to serial module as these do not have any external power. If your custom PCB includes a built-in power supply, then you do not need to pull 5 V power from the USB port.
Example USB to UART serial bridge interface converter from FTDI.
If you want the bridge IC powered off when the USB port is not connected, then you can simply wire the power pin to the 5 V line on the USB connector. Other peripherals that are only accessible via USB could also be wired up to the 5 V USB power source, as long as the total current does not exceed your allowance for your USB generation. For example this could allow you to bring up diagnostic or testing features that are only accessible when USB is plugged in, and they would automatically power down once the USB cable is unplugged.
Accessing Your Processor Via a Terminal
To access the functions on your processor via a USB port, you will need to use a terminal application. Your computer will also need drivers for your bridge IC. Some bridge ICs already have drivers built into MacOS and Windows, otherwise the drivers may be downloaded from the bridge IC manufacturer’s website.
Your terminal application needs to provide COM port access at the appropriate baud rate (usually 9600 baud). There are several terminal applications that can provide this connection, such as PuTTy, TeraTerm, Bash, RealTerm, and YAT (Yet Another Terminal).
If there is terminal support in your microcontroller or application processor, the embedded RTOS that is included with your processor will provide terminal access. Support will generally be included in the codebase you develop in the vendor IDE, or it will be built into the vendor’s application example or reference design. In some cases, the vendor IDE or flashing utility will give you the terminal access you need so that you can monitor your device.
Terminal application configuration in RealTerm.
One feature that can be enabled in your embedded application for testing and monitoring is status display from the chip via the UART interface. When enabled, the chip can broadcast data or status indicators over the UART interface, and these would be sent to the bridge IC. Once the IC is enabled via USB power, and a terminal connection is active via the connected COM port, the user would be able to see those status indicators in the terminal application. Other applications, such as LabVIEW, could also use these data or status indicators for a variety of purposes.
When you’re ready to design a custom PCB with USB to serial access, make sure you use the best PCB design features in OrCAD from Cadence. If you’re ready to take even more control over net logic and board layout, you can graduate to Allegro PCB Designer for a more advanced toolset and additional simulation options for systems analysis. Only Cadence offers a comprehensive set of circuit, IC, and PCB design tools for any application and any level of complexity.
Subscribe to our newsletter for the latest updates. If you’re looking to learn more about how Cadence has the solution for you, talk to our team of experts.