Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serial versus SPI

What is the difference between SPI and serial? In reading an article talking about inter-processor communications, it states that serial interfaces are being replaced with SPI for better/faster comms? What exactly is the difference?

like image 998
jbh Avatar asked Mar 21 '13 14:03

jbh


People also ask

Is serial the same as SPI?

SPI (Serial Peripheral Interface) is a serial communication protocol originally developed by Motorola that enables communication between nearly any electronic device that supports clocked serial streams. SPI uses a master-slave method for communication that enables high-speed data streaming.

How is SPI different from other serial interface?

SPI serial communication protocol is suitable for electronic devices that support clocked serial streams. That means, in contrast to UART, SPI protocol is synchronous. SPI protocol allows high-speed data streaming with the help of the serial data in/serial data out method.

Is SPI a serial protocol?

The Serial Peripheral Interface (SPI) is a synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. The interface was developed by Motorola in the mid-1980s and has become a de facto standard.

What is SPI serial communication?

SPI stands for the Serial Peripheral Interface. It is a serial communication protocol that is used to connect low-speed devices. It was developed by Motorola in the mid-1980 for inter-chip communication.


2 Answers

The word "serial" doesn't mean much. But I'll assume that you are talking about traditional serial communication standards. What's fundamentally different about SPI is that it is synchronous. As opposed to, say, RS-232, an asynchronous signaling standard.

An important property of asynchronous signaling is the baudrate, the frequency at which the bits in a byte are sent. The receiver has to do extra work to recover the clock that was used by the transmitter. A typical UART does so by over-sampling the signal at a rate 16 times the baudrate. The start-bit is important, which synchronizes the over-sampling clock. Delays between bytes can be arbitrary, the receiver re-synchronizes for each individual byte. Problems with this scheme are a mismatch between the transmitter and the receiver clock frequencies and clock jitter, effectively limiting the baudrate.

This is not a problem with SPI, it has an extra signal line that carries the clock signal so that both the transmitter and receiver uses the exact same clock. And is therefore immune from mismatches and jitter, allowing higher transfer rates. No stability requirements at all in the clock frequency, the signals can simply be generated in software. Typical four line wiring looks like this:

enter image description here

SCLK is the clock signal. MOSI and MISO carry the data, SS is a chip select signal. Common ground is assumed. More about it in this Wikipedia article. electronics.stackexchange.com is a good site to ask more questions about it.

like image 161
Hans Passant Avatar answered Oct 25 '22 13:10

Hans Passant


The previous answer is somewhat misleading.

SPI and UART both transfer binary data as bytes and/or words, depending on the hardware. As explained above, one is synchronous and one is asynchronous. Both require an extra data line to be bidirectional. ASCII is an agreed upon interpretation of the binary data and is not actually a factor in either.

like image 22
Bob Bullock Avatar answered Oct 25 '22 14:10

Bob Bullock