Connecting peripheral devices seems to be a rite of passage for designers. In many instances, serial networks provide sufficient performance for the job while minimizing connections between devices. This can be particularly important when the distance between devices is greater than a few centimeters.
Numerous choices are available. (To see a table of popular alternatives, see "Networking Technologies".) Many other alternatives can be counted among the fieldbus, proprietary, and specialized serial interfaces, too. These often compete directly with each other, but most have a niche to fill.
In general, a serial interconnect will contain less than half a dozen wires. These may include power and ground, though not always. Some, like Maxim's 1-Wire, require the ground line. That's why many references to an interconnect count the number of wires that don't include the power lines.
Different architectures and protocols abound. The same is true for master and multimaster support. Likewise, many architectures, such as Ethernet, PCI Express, and Serial RapidIO (SRIO), require a switch fabric.
LOW-END MICROCONTROLLER SUPPORT
Performance and simplicity often are issues when dealing with integrated interfaces for serial network interfaces. I2C, SPI (Serial Peripheral Interface), CAN (Controller Area Network), LIN (Local Interconnect Network), and 1-Wire interfaces are standard fare on 8-bit and larger microcontrollers. Multifunction serial ports typically support these, as well as standard serial interfaces like RS-485, though RS-485 and CAN usually require external transceiver chips.
Most other interfaces employ standard microcontroller outputs, allowing for direct connection between devices. The Inter-IC (I2C) communication link, developed by NXP (previously Philips Semiconductor), is a two-wire solution that provides this type of support (Fig. 1). It doesn't incorporate any error checking, but it does support multimaster operation.
Packets include an address and direction bit that indicates whether the master or the slave sends data. Also, I2C is part of power-management and system-management standards such as PMBus, SMBus, and IPMI (Intelligent Platform Management Interface), which takes advantage of I2C's multimaster mode. And, I2C is royalty-free.
The primary alternative to I2C is SPI (Fig. 2). A master/slave interconnect, SPI normally is used to connect peripheral chips to a host processor. Its chip-select architecture is easy to implement in hardware and software. SPI typically provides a faster transfer rate than I2C, but at the cost of more wires. On the device side, it can be implemented with nothing more than a shift register and some logic gates. Also, SPI provides a very low-level interface compared to I2C's address-based register approach.
CAN and LIN started in the automotive industry (Fig. 3). But while CAN has also found homes in automation, system control, and robotics, LIN still tends to set up camp only in automotive applications. CAN interfaces, readily available on a wide range of microcontrollers, form the basis for many protocols and fieldbus implementations. CAN also uses a different address approach than most embedded networks (see "CAN 101: CAN Can Where Ethernet Does Not").
Most network protocols identify the receiver and sometimes the sender. CAN identifies a packet's data. Its interfaces typically implement multiple filters that check incoming packet identifiers. The filters can mask individual bits, enabling them to recognize classes of data while ignoring others. Furthermore, CAN is one of the few systems that implements a priority scheme, which is also part of the identifier processing (whereby the highest identifier value takes precedence).
Another low-speed (under 1 Mbit/s) interconnect is Maxim's proprietary 1-Wire protocol (Fig. 4). An asynchronous protocol, it can provide minimal amounts of power to networked devices using only an on-chip diode and capacitor. This parasitic approach works well for the simple sensor and control chips that often are used with 1-Wire. While this method isn't unique to 1-Wire, it's most commonly found with these products.
CAN AND FLEXRAY
Higher-speed interconnects regularly build on earlier, slower technologies. FlexRay grew from CAN, and the two have a home in the automotive industry. FlexRay is significantly faster (10 Mbits/s) and more robust and complex than CAN, but the two coexist along with LIN in most new cars.
FlexRay was designed for time-critical applications like automotive brake-by-wire, where safety, reliability, redundancy, and fault tolerance are required. It can synchronize to the clock level and partition a transmission cycle for fine-grain control of data exchange between multiple devices. And, while FlexRay may find its way into other environments much in the manner of CAN, other high-speed interconnects are better suited for non-automotive embedded applications.
With the exception of FlexRay, the interfaces already examined tend to move a more limited amount of data than a packet may contain. Network traffic is often infrequent compared the speed of the processors involved. In many instances, higher performance is necessary while still minimizing the number of interconnect wires. This is where technologies like USB, PCI Express, and Serial RapidIO (sRIO) come into play.
USB continues to gain more traction inside the embedded space. Its original claim to fame was PC peripheral interconnects for keyboards, mice, printers, and the like. It's now commonly used to access analog-to-digital converters (ADCs), motors, and digital cameras in dedicated embedded applications as well. A single USB host interface can support up to 126 devices at speeds up to 480 Mbits/s.
Typically, USB works with a single host and a score or peripherals. Still, it's possible for USB to handle just about any chore with multihost support using SMSC's USB2524 Multiswitch and DisplayLink's (formerly Newnham Research) USB-based display adapter (see "USB Branches Out,").
USB is becoming more popular internally with the advent of inexpensive, easy-to-program, USB-enabled microcontrollers. A USB host, often another microcontroller, can communicate with the device microcontrollers to access services and peripheral data from a range of remote interfaces, from ADCs to motor controls. In fact, a microcontroller's single USB host interface can provide all of this plus access to USB-based storage and Ethernet communication.
Of course, heavy lifting may be required. Enter new serial interconnects like PCI Express and SRIO (see "Not So Fast: Use PCI Express For Lower-Speed Interconnects, Too"). High-end systems often employ four to 32 lanes, where each lane is a full-duplex, four-wire interface. Low-end systems can typically get by with a single lane. They now top out at 5 Gbits/s.
A primary difference between the two is that PCI Express inherits PCI's memory architecture, while SRIO handles small packets with ease. Another major difference is that PCI Express is host-based, while SRIO is a general network like Ethernet. Of course, both have the advantage of direct chip-to-chip connections found in many of the low-end technologies already mentioned.
SRIO tends to be limited to chips like Texas Instruments' TMS320C6454 DSP and Freescale's dual core MPC8572 PowerQUICC III (see "Control The Continuum,"). DSPs often feature 1x interfaces while CPUs contain 4x links. SRIO has yet to find its way into lower-end 32-bit or 16-bit microcontrollers.
The same is true for PCI Express, but PCI Express is more likely to move down to lower-end chips in the near future, given its current support of PCI. Another driving factor in the embedded space will be standards such as PCMCIA's ExpressCard (see "Powerful Portables,"), EPIC Express (see "Ampro Delivers The First EPIC Express Board,"), and COM Express (see "COM Express,"). These standards are pushing the demand for more 1x PCI Express peripheral devices, making them more desirable for microcontroller platforms as well.
Of course, we don't want to ignore the 900-lb gorilla. Ethernet is the de facto networking standard, and 10Mbit/s Ethernet can be found even in 8-bit microcontrollers like Microchip's PIC18F97J60 (see "Ethernet And The 8-Bit MCU,") and Rabbit Semiconductor's Rabbit 4000 (see "Rabbits Galore,"). Ethernet typically requires the external magnetics, and systems are normally connected to external switches. This can be an advantage or disadvantage, depending on the environment.
Ethernet standards also are advanced when it comes to industrial automation, though this tends to be for outside-the-box connections (see "Industrial-Strength Networking,"). If compatibility and throughput issues arise, then moving up from 10BaseT is a relatively easy option—particularly because higher-end microcontrollers have 100-Mbit/s and 1-Gbit/s Ethernet interfaces built in.
One of the major points for and against Ethernet is the complexity of the protocol stack. Still, if low-end control is all that's necessary and network communication is isolated, then the TCP/IP stacks often can be disposed of in place of low-level interfaces or simply an IP stack.
ROLLING YOUR OWN
Give developers a port, a UART, or an FPGA, and they can bit-bang their own network interface. They can also implement many of the interfaces mentioned here, but beware. Some architectures have licensing issues, and these issues can vary. For example, some may simply limit the use of a term or logo, while others may allow you to create devices but not masters or vice versa. But that's a story for another day.
NEED MORE INFORMATION?
- Atmel www.atmel.com
- CAN in Automation (CiA) www.can-cia.org
- Flexray Consortium www.flexray.com
- Freescale www.freescale.com
- LIN Consortium www.lin-subbus.org
- Maxim www.maxim-ic.com
- Microchip www.microchip.com
- NXP www.nxp.com
- PCMCIA www.pcmcia.org
- PCI-SIG www.pcisig.com
- Rabbit Semiconductor www.rabbitsemiconductor.com
- RapidIO Trade Association www.rapidio.org
- Texas Instruments www.ti.com
- USB Implementors Forum www.usb.org