Table of Contents:
Even though it is developed primarily for the communication between host processor and peripherals, a connection of two processors via SPI is just as well possible. The SPI Bus is usually used only on the PCB. There are many reasons which prevent us from using it outside the PCB area. Firstly SPI was designed to transfer data between various IC chips, at very high speeds. Due to this high-speed the length of the bus lines should not be too long, because it increases the reactance and the Bus becomes unusable. However, its possible to use the SPI Bus outside the PCB at low speeds, but this is not quite practical. The peripherals can be a Real Time Clocks, converters like ADC and DAC, memory modules like EEPROM and FLASH, sensors like temperature sensors and pressure sensors, or some other devices like signal-mixer, potentiometer, LCD controller, UART, CAN controller, USB controller and amplifier.
Data and control lines of the SPI and the basic connection:
An SPI protocol specifies 4 signal wires.
1. Master Out Slave In (MOSI) - MOSI signal is generated by Master, recipient is the Slave.
2. Master In Slave Out (MISO) - Slaves generate MISO signals and recipient is the Master.
3. Serial Clock (SCLK or SCK) - SCLK signal is generated by the Master to synchronize data transfers between the master and the slave.
4. Slave Select (SS) from master to Chip Select (CS) of slave - SS signal is generated by Master to select individual slave/peripheral devices. The SS/CS is an active low signal.
Sometimes serial Data In [SDI] is used as another name in place of MOSI and Serial Data Out [SDO] for MISO.
Single master Single slave SPI implementation
Among these four logic signals, two of them MOSI & MISO can be grouped as data lines and other two SS & SCLK as control lines.
A master-microcontroller can talk to multiple SPI Peripherals. There are 2 ways to set things up:
1. Cascaded slaves or daisy-chained slaves
2. Independent slaves or parallel configuration