SPI(Serial Peripheral Interface) is a single master multiple slave serial transmission protocol that works in full duplex mode.
- There can be only one master but there can be multiple slaves.
- MOSI- Master out Slave In
- MISO- Master In Slave Out
- SCLK- Clock Signal
- SS or CS- Slave Select or Chip Selecthe
- The data is transmitted using shift register.
- With the number of clocks equal to the word size(generally 8) the master and slave would have exchanged the value in their shift register.
- They can now process the data they have received or/and can load new data in the shift register.
Lets Talk Business and Discuss The actual Protocol
- To start off , the the master configures the clock rate of transmission(frequency should be less than the maximum supportable frequency).
- The master then sends a chip select signal 0 on the chip select line which it wants to choose.
- Since the lines are active high so by default they are high(initially).
- Sometimes a waiting time is involved, so the master must wait for that duration before it starts the clock cycle.
- During each SPI clock cycle a full transmission happens with this operation-
- The master sends one bit on MOSI line and the slave reads on the same line.
- The slave sends one bit on the MISO line and the master reads on the same line.
- We may not need all these transmission for our purpose but as per the protocol this has to happen.