Serial versus SPI
Asked Answered
M

4

14

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?

Mogul answered 21/3, 2013 at 14:48 Comment(0)
S
26

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.

Sprain answered 21/3, 2013 at 15:49 Comment(1)
Really nice explanation, although should it be "over-sampling"? I think of sub-sampling as being at less than the rate of interest.Ivatts
M
2

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.

Merrygoround answered 31/3, 2017 at 0:12 Comment(0)
C
1

The first answer is almost correct with some small comments:

1) SPI is a subtype of SSI (another example is RS-422)
2) SPI uses the master/slave concept with CS/SS (chips select, slave select) pin ...

Thus a master can have multiple slaves and select between them using the SS pin. Also, on some chips, using the SS the chip can be switched from master to slave.

Cummins answered 10/1, 2020 at 13:21 Comment(0)
N
-3

SPI is a bidirectional data protocol. The difference is that SPI uses an exchange of binary data. And UART uses ASCII, making it much slower data transfer

Nik answered 20/1, 2015 at 0:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.