This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

query on SPI PROTOCOL

Hi,

I have a query regarding spi protocol.

Whether SPI protocol is a 4-wire protocol or 3-wire protocol basically.

Thanks

Gurumoorthy

  • It is a 3-wire protocol with a 4 th wire to select devices if more than 2 devices are connected to the same wires.
  • Well, it's a 3+x wire protocol. The bus itself has three wires (in/out and clock), if you don't count the (also needed) GND wire. But each slave usually requires its own, separately controlled chip select line.
    The 4-wire mode in MSP means something different. It uses an additional input line (!) to control the output in slave mode, so being de-selected removes the out signal form the bus even if the software hasn't handled the de-selection yet. It also helps on multi-master setups. If the MSP is the only master or the only slave, this mode is not to be used.
    Please note that he meaning of the SPI clock polarity bit in the MSP hardware is opposite form the Motorola notation.
  • now while writing a document, should I write #-wire SPI or-wire SPI in general terms
  • It depends on the document. If it describes a specific application and the information is relevant for the reader you should possibly mention which hardware connections are used. If it is a general description of the SPI protocol then you should say that it is a 3-wire bus - at least for transmissions in both directions. Some slaves just need CLK and one data-line if there are only data exchanges in one direction. The additional chip select line is quite normal for SPI devices, but I would not say that they belong directly to the SPI bus. But since CS is used in most applications I would say something about it.

    Dennis
  • Since the SPi standard does not define the meaning of '3-wire' or '4-wire', using anything but plain "SPI" is not covered by any common agreement and therefore meaningless.
    You should rather 'explain', like "SPI with 3 bus signals and one additional select signal per slave" or something like that. This leaves no ambiguity then. As Dennis (indirectly) mentioned, there are SPI variants that are only one direction, and even one that uses one data line for both directions, which is strictly spoken no SPI at all.
    Yes, CS is not part of the SPI bus, as bus signals are connected to all peers,and CS isn't. But they are part of the SPI specification and usually required to make things work.
    I've seen setups called 'SPI' where all slaves are daisy-chained, and the Cs line was rather a latching signal, wired to all of them.
    I've also seen an SPI setup where all slaves were daisy-chained, and after a common reset , the first slave was taking the first data bits sent (and swallowing the clock signal), then passing all following bits with the clock pulses through to the next in the chain. All this has been called SPI.
    Some smart RGB LEDs use a derivate of the last one with a fixed baudrate and a timeout as reset. So the whole LED only has VCC, GND, IN and OUT and you can program as many LEDs in a chain as you want with just one signal. At least the term "SPI" wasn't used here :)

**Attention** This is a public forum