USB connectivity is ubiquitous in the PC and consumer market, and there are good reasons for design teams working across an array of embedded applications to add USB to a design. Embedded designs can leverage the considerable effort that has made USB a universal plug-and-play interconnect. Moreover, the interface offers the ability to distribute power and handle data over a single cable – a feature that most legacy serial interfaces lack. Let's consider the different options available for adding USB support to MCU-based designs as well as in peripheral products that are used with MCUs.
First let's define the scope of what we will discuss here. There are certainly many MCUs that come with integrated USB support these days. Indeed, just the Microchip USB-enabled MCUs
available from Digi-Key occupy some 29 web pages. Still, many low-end MCUs such as those in the Microchip PIC10
8-bit product lines lack USB support but include other serial interfaces such as SPI (serial peripheral interface). Moreover, a design team may choose to partition a design, including a USB-enabled MCU in the primary system while adding modular peripheral functionality in a target device located at the other end of a USB cable that conveniently supplies power and data.
A number of IC companies offer USB controller and bridge ICs that can come in handy in adding USB connectivity to a system. The ICs vary in terms of the type of serial interfaces they support and in terms of other functions integrated on chip such as memory or I/O lines.
USB to UART bridge
The most basic bridge IC is a simple USB to UART bridge such as Silicon Labs
offers in its CP21xx family including the CP2101
, and CP2110
ICs. The typical implementation is depicted in Figure 1. The bridge directly supports RS-232 interfaces and other options when used with an external transceiver. If, for instance, you had a legacy MCU-based device that relied on serial communications, the CP21xx family could easily convert the design to USB connectivity, and the IC supports a virtual COM port (VCP) function.
Figure 1: The Silicon Laboratories CP21xx family of USB to UART bridge ICs allow design teams to add USB support in peripherals with legacy serial interfaces.
The differences in the family members come down to I/O features and memory. For instance, all of the family members include EEPROM that can be used to store USB-specific data such as a vendor ID and even power descriptors. The memory configurations vary from 296 to 1,024 bits.
That USB vendor IC, device type, and other data do not have to be used in specialized embedded applications, but should be used in compliance with the standard if a device design is intended for general usage with USB hosts. The ICs offer from 0 general-purpose I/O lines on the CP2101/02 to 10 I/O lines on the CP2110. You can use those I/O lines for status and control needs.
A USB connection realized with an interface such as SPI can support higher data rates. And a number of companies including Maxim and Microchip have SPI-based USB ICs. And almost all newer MCUs include an SPI interface.
Host or target
Maxim, for example, offers the MAX3420E and MAX3421E USB controllers that can add USB support to any processor-based system that has an SPI port. The ICs work with SPI clocks as fast as 26 MHz. The SPI implementation is a slave-mode interface, meaning that the USB controller requires an SPI master in the MCU or other processor in the system.
A simple USB-bus-powered widget based on the MAX3420E requires little more than the processor, and a voltage regulator that derives a 3.3 V VDD power supply from the USB cable. The MAX3420E IC is used only in USB peripheral or target-device applications. There is an integrated USB full-speed transceiver that supports 12 Mbit/s rates. The IC supports three- and four-wire SPI implementations. It also includes four general-purpose I/O lines.
For USB host implementations, Maxim offers the MAX3421E. That IC includes eight general-purpose I/O lines. The I/O lines can serve a variety of purposes, but in some cases allow the host MCU to essentially reclaim I/O lines that are not available in the MCU because pins are dedicated to the SPI link. Note also that both of Maxim's USB ICs include internal signal-level translators so that the SPI link can operate at voltages ranging from 1.4 to 3.6 V.
Microchip, meanwhile, has a couple of USB-centric ICs to support its efforts in the MCU space, including the MCP2200 USB to UART IC. Microchip’s latest product is quite different in that the MCP2210 USB to SPI IC implements an SPI master-mode link. Figure 2 depicts the block diagram of the IC. It integrates 256 bytes of EEPROM.
Figure 2: Microchip’s new MCP2100 USB controller IC includes a master-mode SPI implementation that can be combined with sensors, data converters, and other peripherals in a bus-powered target device.
The IC could be used to interface with an MCU, but it could also be used to directly control SPI-based ICs with a variety of peripheral functionality. For example, you could use the IC to design USB-enabled data-acquisition modules with no MCU in the target device. Such a module could be deployed with an MCU-based control system or even with a PC.
Consider the possibilities of a USB-powered data-acquisition module. Microchip, for example, offers the SPI-based MCP3204 A/D converter, which could be deployed as a slave to the MCP2100 controller. That four-channel data converter would allow the USB host to capture data over the USB cable.
Microchip offers a number of other SPI-based peripherals that could be combined in such a target device. The MCP2100 USB controller integrates nine general-purpose I/O lines. And eight additional lines could be added using the SPI-based MCP23S08 I/O port expander IC. We covered port expanders in a recent TechZone article (“I/O-Port Expanders Offer Flexibility in MCU-Based Designs”) available in the Digi-Key library if you want more information on the topic.
You can also add memory and sensor functionality to an MCP2210-based device. The 25LC02 SPI EEPROM integrates 2k bits of memory. Sensor options include the SPI-based TC77 temperature sensor. Microchip integrated USB HID (human input device)-class support in the MCP2100 and offers drives that will jumpstart the device-design process.
The choice is yours
USB support can prove to be a valuable feature in all types of embedded applications. The interface can eliminate the need to separately include a power supply in your device. You can easily add USB host capabilities into MCU-based systems today. USB-based target devices can work equally well with an MCU-based host or a PC. While an MCU-enabled MCU may be your first thought when faced with a USB design, a dedicated controller IC might be the best choice especially if you are adapting a legacy device to USB or if your design needs a low-cost small-footprint MCU.