
In this months Ask Larry, I would like to cover a topic which I think would benefit customers greatly. I am going to talk about Serial Peripheral Interface or SPI. SPI is a synchronous serial protocol typically used by a microprocessor to communicate with one or more peripheral devices. The types of devices can be, but are not limited to, memories, Analog to Digital Converters, Digital to Analog Converters, etc. You will find that any Rabbit-based product that uses an A/D or D/A uses SPI as the means for communication.
SPI technology dates back to at least the early '70s. Originally, SPI was developed by Motorola as a means of connecting analog peripheral devices to their 6800 line of microprocessors. Some of their processor manuals contain chapters describing the specific SPI features of that processor. These descriptions can give you a good explanation of how SPI works and what is required for the connections. Visit the following link to a brief tutorial on SPI.
Below is a nifty block diagram of the connections required between a Rabbit processor and several SPI devices. SPI consists of Master-Slave system with the processor being the Master. There are three signals which are common to all the devices: Clock, Transmit Data and Receive Data. Each peripheral device has its own Chip Select line. Only the device which has an active Chip Select will respond to the commands from the Master. The Clock signal is always generated by the Master.
There are four SPI “modes” that define four different phase relationships between the clock and the data. Whenever I am asked how to interface an SPI device, I always tell a customer to look at the SPI timing specifications of the device and match it with the diagrams in the Rabbit processor User’s Manual. This is very important – if the correct mode is not chosen there is a very good possibility that the Slave device will not respond properly. Just as an example and a cautionary note – I designed a system as a home hobby project which used two SPI devices from the same manufacturer. They used different SPI modes so I had to dynamically change the mode during program execution depending on the device I was programming.
SPI is a very common and relatively fast communications method which can be used to add quite a bit of functionality to any microprocessor based system. If used properly it can greatly enhance the utility of your system.
- Larry C.
Larry Cicchinelli is Rabbit Semiconductor’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.
Submit your questions for Larry via email at
AskLarry@rabbit.com
Read more Ask Larry Answers