Embedded Protocol – SPI Communication

SPI abbreviation for Serial Peripheral Interface, SPI is Synchronous Serial Communication interface. Used for short distance communication developed By Motorola in 1980 after becomes defacto standard. SPI communication is full duplex communication mode. Its also called sometime Four Wire Serial Bus (FWSB). Contrasting with Three, Two and One Wire  Serial  Bus. Four wire protocol SCL, SS, MISO and MOSI. SPI is single master protocol.

SPI Applications

  • SPI Bus is commonly using for flash memory, sensor, real-time-clocks(RTC)
  • This bus is commonly used to send the data between micro-controllers to smal peripherals like LCD Display, Sensors, Shift Registers, ADC.
  • Typical application is secure digital card and Liquid Crystal Display system

SPI Speed

SPI master only generate the clock signal. So the communication speed is depends up on master clock. SPI slave support various speed. SPI master can’t generate clock signals, it’s only synchronize with master clock signal

  • Microchip’s SPI Slave MCP23S08 Supports up to 10MHz SPI™ clock speeds
  • Microchip’s SPI Slave MCP23S17 Supports up to 10MHz SPI™ clock speeds

SPI Signal Lines

  • SCLK  or SCK   –    Serial Clock (Output from Master Device)
  • MOSI, SIMO, SDI, DI, DIN, SI or MTSR – Master Output Slave Input (Data out from the master)
  • MISO, SOMI, SDO, DO, DOUT, SO, MRST – Master Input Slave Output (Data output from the slave)
  • SDIO or SIO – Serial Data I/O (Bi-Directional)
  • CS, SS, SSEL, nSS, /SS, SS# –  Chip Select or Slave select (Often Active Low, output from the master)

SPI Hardware

  • Status
  • Control
  • Data register
  • Shifted logic
  • Baud rate generator
  • Master/slave control logic
  • Port control logic

SPI block Diagram

SPI Master and Slave Connections

Single Master and single Salve Connection in SPI

Single Master and Multi Salve Connection in SPI

SPI Independent slave configuration

SPI Daisy chain configuration


SPI Communication Signals

SPI ‘Clock polarity’ (CPOL) and ‘clock phase’ (CPHA).


SPI bit-banging

Example of bit-banging the master protocol

 Below is an example of bit-banging the SPI protocol as an SPI master with CPOL=0, CPHA=0, and eight bits per transfer.

Example : Bit banking for sending a byte on an SPI bus.

SPI Advantages  & Disadvantages

Advantages of SPI

  1. Full duplex communication
  2. Higher throughput than I²C protocol
  3. Not limited to 8-bit words in the case of bit-transferring
  4. Arbitrary choice of message size, contents, and purpose
  5. Simple hardware interfacing
  6. Typically lower power requirements than I²C due to less circuitry.
  7. No arbitration or associated failure modes.
  8. Slaves use the master’s clock, and don’t need precision oscillators.
  9. Transceivers are not needed.
  10. At most one “unique” bus signal per device (CS); all others are shared

Disadvantages of SPI

  1. Requires more pins on IC packages than I²C
  2. No in-band addressing. Out-of-band chip select signals are required on shared busses.
  3. No hardware flow control
  4. No slave acknowledgment
  5. Multi-master busses are rare and awkward, and are usually limited to a single slave.
  6. Without a formal standard, validating conformance is not possible
  7. Only handles short distances compared to RS-232, RS-485, or CAN.

SPI Interview Questions

This SPI Interview questions for beginner as well as expert in embedded system

Q : What is SPI?

  • SPI is a wired serial communication protocol. its a single master communicate with multi slave protocol and it’s synchronous full duplex communication.

Q : What is the abbreviation of SPI? or What does SPI mean? or What is the acronym SPI?

  • Serial Peripheral interface

Q : SPI is serial or parallel communication?

  • SPI is serial communication. By serially send and receive data in same line.

Q : SPI is synchronous or synchronous communication?

  • SPI is synchronous communication because of master generate clock signal its sync with slave.

Q : SPI is half duplex or full duplex?

  • SPI is full duplex communication because SPI slave and master can communicate each other in same time.

Q :  How many wires/lines required for SPI communication?

  • Genrally required 4 wires for SPI communication and wires may be required additionally one(SS-Slave select) It’s depends upon the number of slave communicate with master.

Q :  What are  signal wire name of SPI communication?


Q : What is SCK wire in SPI?

  • SCK – Serial Clock Signal

Q : What is MOSI wire in SPI?

  • MOSI – Master Out Slave In

Q : What is MISO wire in SPI?

  • MISO – Master In Slave Out

Q : What is CS/SS wire in SPI?

  • CS -Chip Select

Q : What is the speed of SPI?

  • SPI works up to 10Mhz speed. Compare to other wired communication protocol, SPI is much faster.

Q : Does SPI need a baud rate?

Q : What is the maximum speed of SPI?

  • Maximum Speed of SPI is 10Mhz

Q : What is the minimum Speed of SPI?

  • If you know the answer please inform to us [email protected] or WhatsApp +91-8300026060.

Q : Which device (Master/slave) generate clock signal in SPI?

  • SPI master only generate clock signal. SPI Slave device function is should sync with SPI master clock.

Q : How to set SPI bus speed in master device?

  • If you know the answer please inform to us [email protected] or WhatsApp +91-8300026060.

Q : is i2c or SPI faster?

  • SPI is always faster then I2C Communication. Because SPI maximum speed supports 10Mhz, But I2C maximum speed supports 5Mhz.

Q: How many slaves can be connected in SPI?

  • Maximum number of devices to connect depends on two conditions.
    1. Depends on number of slave select lines on the hardware, i.e., if my SPI master has 4 slave select lines then we can connect 4 slaves normally which we do for chip select in peripherals.
    2. Depends on fan-out of the pin, fan-out is nothing but the maximum number of possible devices that can be connected to pin
  • The number of SPI slaves is not limited. But at the same time, it is restricted according to the number of hardware pins of controller. In fact, you can add digital muxes (multiplexors) and control more slave devices than you have digital pins on the controller. However, the SPI was design for communication over short distances within a box. So, the physical size of the bus can become a problem (bus capacitance, EMI).


Q : What will happens if two SPI slaves same time communicate with Master (two Cs pins are high)?

  • If you know the answer please inform to us [email protected] or WhatsApp +91-8300026060.


Q : What are the limitations of SPI interface?

  • If you know the answer please inform to us [email protected] or WhatsApp +91-8300026060.


Q : What happens when mode fault is enabled in SPI (Serial Peripheral Interface)?

  • If you know the answer please inform to us [email protected] or WhatsApp +91-8300026060.

Q : What are the hardware main part of the SPI?

  • Status, Control, Data register, Shifted logic,  Baud rate generator, Master/slave control logic, Port control logic

SPI True or False Questions

Q : Can SPI slave can generate clock signal?

  • No. SPI slave function is should synchronize with SPI master clock.

SPI Interface Example



One thought on “Embedded Protocol – SPI Communication”

  1. Excellent site you have here but I was curious about if you knew of any message boards that cover the same topics talked about here?
    I’d really love to be a part of online community where I can get opinions from other experienced individuals that share
    the same interest. If you have any suggestions, please let me know.
    Bless you!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

if you have any queries call us +918300026060 or WhatsApp Dismiss


Your Cart

%d bloggers like this: