ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

SERIAL INTERFACE FOR EMBEDDED DESIGN


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

SERIAL INTERFACE FOR EMBEDDED DESIGN

Lessons from the Trenches by Art Eck

Start ý Trying I2C ý Sources and PDF

Many mixed-signal semiconductor devices offer serial interfaces that significantly reduce the pin count and cost of the mixed-signal device and the microcontroller in the system. Although the fundamental benefits of using interfaces are obvious, determining the appropriate serial interface for the design is an important consideration. A comparison of the three major serial protocols helps determine which one may be most desirable for a given design.

The three major serial protocols available for DACs, ADCs, and digital potentiometers are SPI, Microwire, and I2C. Both Microwire and SPI require three I/O pins for communication and a fourth pin for chip select. SPI has the advantage of being more broadly offered, providing typically higher clock speeds, and having the most compact and easiest code to write.

In terms of development time and demands on system memory, SPI protocol is a clear winner. Not only is the code easier to write, but usually less code is required for a given task. Shorter, easier-to-write code adds up to shorter development time. With a more compact code, a smaller requirement is placed on memory, which can help to reduce the overall system cost. Also, many microcontrollers offer an onboard SPI port that can further reduce development time.

In addition, the SPI serial protocol offers a faster clock speed. With less code to execute and a faster clock, SPI solutions are capable of shorter cycle times when performing a desired task. Where system speed is important, the SPI serial protocol again is the front runner.

The SPI serial protocol suffers a significant setback when compared to the I2C serial protocol in terms of the chip-select pin. In a traditional SPI bus structure, every SPI device must be selected separately when addressed. This means that the system must have a separate select line to select each device (see Figure 1). This can place a significant demand on the number of pins on the microcontroller or even require a separate control device.

Figure 1ýThis arrangement can place a significant demand on the number of pins on the microcontroller or even require a separate control device.

 

I2C serial protocol allows devices to be selected by a command containing the device address. This address can either be stored in nonvolatile memory in the device or hardwired by address pins on the device. Either way, the I2C protocol offers a significant reduction in system resources to select the device over a traditional SPI configuration. The software command completely eliminates the need for a hardware chip-select pin in order to have proper bus operation.

To minimize the system requirements in an application using multiple SPI devices, many manufacturers offer the ability to daisy chain. It is required that the SPI device have a data-out line (SO), although it does not transmit data back to the microcontroller.

As can be seen in Figure 2, only one chip-select line is needed in the daisy chain configuration. All devices are selected at the same time and each then functions as a shift register, and the data is shifted down the line until it arrives at the proper device. The last device in this chain does not need to have an SO line because there are no more devices to shift data out to.

Figure 2ýAlthough the daisy chain configuration eliminates the need for separate selection of each device and the demand placed on system resources, this configuration also lowers bus speed.

 

There is a price to pay for using this configuration. Although the daisy chain configuration eliminates the need for separate selection of each device and the demand that places on system resources, this configuration also lowers bus speed. A typical SPI bus speed of 10 MHz is lowered to 5.8 MHz as a result of propagation delay of data coming out of the SO pin of the previous device. (This is still significantly faster than most I2C buses.)

To reduce the number of commands needed to send data down the daisy chain, all the devices are loaded with zeros upon assertion of the chip-select pins. In this way, the command shifted out is the NOP command. So, as soon as the command from the microcontroller reaches the proper device, transmission can stop. There is no need to load NOP into all the devices in the chain that do not receive the command to prevent erroneous command execution. With NOP load during chip selection, all devices are preloaded saving valuable command shifting time.

Because the SPI interface is licensed at no cost, it is likely to continue to grow in popularity. A designer new to serial protocols will likely gain the most use from learning SPI, in that it yields a large diversity of products now and is likely to continue to grow in the years to come. Of all the serial protocols available today, knowledge of SPI is also likely to yield the longest use for the broadest selection of applications.

With all of the benefits of the SPI serial protocol, it seems a designer could just abandon other protocols and use just this one. Although this may be true when compared to Microwire, which seems to gain its acceptance more from legacy than from offering benefits beyond that of SPI, I2C is able to stand on more than the merits of past use.

NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ