

Summary
This document is a
non-technical survey of communication standards that have, or may have, some
usefulness for embedded applications. It contains a brief description of
each standard, but focuses on the comparative advantages and especially the
disadvantages of each.
The Electronic Industries
Association formerly released all of its specifications as RS (Recommended
Standard) plus a number. More recently, the EIA changed its name to the
Electronic Industries Alliance, joined forces with several other single
industry standards organizations, and changed its standards designations to
EIA- plus a number.
EIA 232
The original RS 232
specification described how to connect a mechanical Teletype machine to a dumb
modem. For all other applications, the engineer was left to his own
imagination. Engineers responded with great imagination, and eventually
entire books were written on connecting machine A to machine B.
For many years, EIA 232
was available on every desktop computer, but this is no longer true.
Apple Macs don’t have any EIA 232 ports. Home and home office machines
from Dell and HP don’t include serial ports, although their larger
(“professional”) machines still do. These ports are being replaced by
USB, but EIA232 is still the fastest path to a solution for point-to-point
short-range communication, if only because every embedded programmer already
has a filing cabinet drawer stuffed with routines written years ago.
EIA 232 is specified for
data rates to 20K bps at distances up to 50 feet, or 2500 pF. What the
heck is that equal to? For telephone grade wire, which is 24 gauge solid
unshielded twisted pair (UTP) with PVC insulation, it works out to about 100
feet. For Cat 5 UTP, which is only about 15 pF per foot, it is about 160
feet. These distances are for the maximum bit rate. Texas Instruments
ran some tests years ago that showed that at 9600 bps EIA 232 would work
perfectly well with 500 feet of cable.
The required hardware can
be cheap, if the board already has +12V and –12V digital power available.
Otherwise, the required DC-DC converter requires several capacitors, and the
cost and board space can become a consideration.
The primary drawbacks to
EIA 232 are that it connects only two points, the data rate is not up to
modern requirements, there is no standard communication format, and there is
very little noise immunity.
EIA 561
EIA 561 is the same as EIA
232, except that it uses modular (telephone) connectors.
EIA 422
EIA 422 was originally designed as an RS
232 “extension cord”. It uses differential signaling, so it isn’t plug
and play but it can handle data rates to 100Kbps and 4000 feet of cable.
EIA 422 also specifies a party line mode with one transmitter and up to 10
receivers. There are some very non-standard dual half duplex concoctions
that allow bi-directional communication after a fashion, but EIA 422 is not
true multi-point. These set-ups offer no advantage over EIA 485.
EIA 485
EIA 485 was the first high
speed, long distance fully bi-directional communication specification.
It is still the only EIA hard wired (that is, non-RF) communication standard
that allows multiple transmitters and receivers in a bus configuration.
A configuration can get by with a single two wire twisted pair if half duplex
is sufficient, while two, two-wire twisted pairs will provide full duplex.
Half duplex is very easy
to hook up, although, since the standard connector is a DB9, there are still
several opportunities to get it wrong. Since EIA 485 is differential, it
is very reliable, especially in noisy environments. The required
hardware is low cost, about mid-way between EIA232 and CAN bus.
The specification allows
for up to 32 “unit loads”. But not all transceivers are unit loads. The
more recent designs are ¼ or even 1/8 unit load and so a network can have up
to 128 or 256 devices respectively.
The specification allows
data rates up to 10 Mbps and cable length to 4000 feet. “Short” cables
don’t require termination, but termination is required for longer cables.
A short cable is defined as one where the rise time of the signal is at least
four times the propagation delay through the entire cable. There are two
ways to terminate the cable correctly. One is to put a 120-ohm resistor
across the inputs to the units at both ends of the cable. The other way
uses that resistor, plus “fail safe” resistors to power and ground, also at
both ends. The fail-safe resistors force the inputs to a known state
even when the cable fails or falls off. However, the termination and
fail-safe resistors greatly increase the power required. One way to
reduce the power is to use zener diodes instead of resistors for the
termination. They are much more expensive, but draw no power at all
unless there is an over- or under-voltage condition.
One of the drawbacks to EIA 485 is the
output structure is optimized for high-speed. A side effect of this is
that both transistors are on simultaneously during every output transition.
This “feature” enables high-speed operation, but draws enormous amounts of
power; in fact, for CMOS transceivers about 99% of the total power drawn
during normal operation is used during this transition. It also injects
noise into the output signal, which can be very hard to get rid of.
There are several ways to help cut the fat out of this power budget. One
is to send fewer, longer messages. This reduces the number of overhead
bits sent, which in some formats is considerable. Another tactic is to
disable the transceiver in idle mode. This works best when used with
transceivers that wake up and connect automatically when a message is
detected. Active termination? REVISIT THIS LATER.
EIA 644
High data rates, low
power, low noise differential signaling
800 Mbps at up to 30 feet
or so
Many uses in PC
backplanes, 3G base stations and video
CAN
CAN was originally
developed as the Car Area Network by Bosch for automotive engine controller
applications. As such, it is extremely reliable in noisy environments,
very low cost, widely available, and has lots of development support.
Renamed the Controller Area Network, it has found wide acceptance in many
stationary applications including vending machines. Consistent with its
automotive heritage and widespread use in vehicles, CAN is the lowest cost
communication protocol. It is an excellent choice for large networks of
hard-wired controllers that need to exchange medium quantities of data at
medium rates
CAN is fully differential
and has built-in CRC and automatic message resend if necessary. The CAN
controller handles all error detection and message retransmission; the
designer does not have to even think about them. However, this does mean
that message timing can be described as elastic at best. Messages will
eventually get through, but priority must be planned carefully in advance.
All messages are broadcast to all nodes. Every message is accepted
either by every node or by no nodes. In the latter case, it will be
retransmitted automatically. Although a node receives every message, it
only acts on some as described below.
CAN was specifically
designed for reliable communication in difficult circumstances. All
random errors of up to 5 bits per message are detected. All burst errors
of up to 15 bits are detected. All errors of any odd number of bits are
detected. The odds of an undetected corrupted message are less than
4.7X10-11. Detected corrupted messages are automatically
resent
A message can be acted
upon by one, several or all other nodes. Nodes don’t have addresses, so
a node can be added or subtracted at any time. Nodes act upon messages
based on message acceptance filters. This means that one message can be
accepted and acted upon by multiple nodes and that any one node can accept and
act upon multiple message identifiers.
Message identifiers are
always either 11 bits (“Standard format”) or 29 bits (“Extended format”).
Messages may have zero to
64 bits of data. Zero length messages can use the identifier to send
simple commands such as a command to turn a particular control on or off.
Every node can transmit
data whenever the bus is idle. Arbitration is handled bit by bit.
Every node that is transmitting is also monitoring the bus. When the
level on the bus doesn’t match the level that the node is transmitting, then
that node has lost arbitration and immediately stops transmitting. It
will automatically retry when the bus goes idle.
USB
USB was designed to simplify the
connections between a host PC and up to 127 associated peripherals. In
particular, it was intended to open up the PC to peripherals that didn’t exist
at the time that the USB bus was created. It is designed to be low cost
and very easy for the average end user to connect and use.
Unfortunately, none of the readers of this document are likely to qualify as
average end users, and USB has significant drawbacks for engineers and
programmers.
There are three
transmission standards under the USB label.
The first is Low Speed.
It is designed for human interface devices (HID) with short, infrequent
messages. Example devices are keyboards, mice, and monitor configuration
applications. Data rates are limited to 10 to 100 Kbps and messages are
limited to 8 bytes or fewer. The specification states that devices in this
class are limited to one 8-byte message every 10 ms, although Win98 doesn’t
enforce this limit.
The second is Full Speed
or Medium Speed. It is designed to take over audio and telephone
applications and can run at 500 Kbps to 10 Mbps Maximum data payload is 8, 16
32 or 64 bytes per message. Full Speed guarantees message latency and
bandwidth.
The last is High Speed,
which is designed for video and disk applications. It can run at 25 to
500 Mbps. It also guarantees latency and high bandwidth.
USB uses differential
signaling and connectors that at first glance resemble each other, but there
are really two different connectors. All “downstream” connectors are
alike. All “upstream” connectors are alike, but are different from, and
not interchangeable with downstream connectors. Downstream connectors are the
squarish ones, while upstream connectors are flat rectangles. The
connectors can also distribute power to downstream devices. Power is
limited to 5V (at the source) and at least 500 mA but no more than 5A.
Devices taking power from the bus can’t count on any more than 4.4V.
The host is always totally
in charge of the communication link. When a device is connected, the
host tells it to reset, and then the host assigns a unique address to the new
device and configures it.
Error handling consists of
CRCs and up to three retries before the host controller informs the client of
a problem. Other error recovery is up to the client program, but USB is
not intended for noisy applications. In particular, the CRC used is the
IBM EBCDIC generator polynomial, (x16 + X15 + X2
+1) which will detect all single and double bit errors. It is not
intended to be as bulletproof as the patterns used by CAN.
The primary disadvantage
of USB is that there is no such thing as a generic interface, and no
equivalent to a terminal emulator. Every application needs a custom PC
program. Also, for low speed interfaces (the only practical kind for
microcontrollers like the 68HC908 and others of that class) the message
structure is limited to 8 bytes at ten millisecond intervals.
The primary advantage of
USB is that it is now found on every new PC, both desktop and laptop.
Bluetooth (802.15)
Bluetooth is primarily
intended for short-range cable replacement applications. Products
available now include wireless mice, keyboards, headphones, wireless hands
free cell phones and RS232 cable replacement. Bluetooth features cheap
hardware, at least in comparison to other RF solutions, but certification
costs offset this in low volumes. Bluetooth must co-exist with many
competing transmitters in the same band including microwave ovens, portable
phones, garage door openers and many other radio services including Wi-Fi and
ZigBee.
A Bluetooth connection is
designed for either point to point with exactly two ends (called unicasting),
or a point to multipoint configuration (multicasting). This second
mode has one master and up to seven slaves arranged in what the standard calls
a piconet. For both types of links, the master always initiates every
message exchange. The slaves never communicate with any other slave, and
never initiate communication with the master. A device may be part of
more than one piconet at the same time, and may be a slave in one and a master
in another. One device may never be the master in more than one piconet
at a time. This is because the piconet is synchronized to the master’s
clock.
All Bluetooth links must
one of the predefined protocols. There are more than two-dozen, covering
every application from headphones to FAX, but only a few are of any interest
for embedded applications. These are the Serial Port Profile (SPP) at
the “higher” level, and some lower level protocols including RFCOMM, Link
Access Protocol (LAP), Link Manager Protocol, (LMP), and the Logical Link
Control and Adaptation Protocol (L2CAP). The Serial Port Profile is
specifically intended to replace RS232 cables, and so many Bluetooth features
are optional. This includes authentication, encryption, authorization,
and bonding. RFCOMM is used as the transport protocol for the Serial