What is Serial Peripheral Interface or SPI?
The Serial Peripheral Interface or SPI bus is a simple 4-wire serial communications interface used by many microprocessor/microcontroller peripheral chips that enables the controllers and peripheral devices (Such as an LCD Display) to communicate too each other. Even though it is developed primarily for the communication between host processor and peripherals, a connection of two processors via SPI is also possible.
The Serial Peripheral Interface (SPI) bus, which operates at full duplex (means, signals carrying data can go in both directions simultaneously), is a synchronous(occurring at the same time; simultaneous.) type data link setup with a Master(processor/Pic) / Slave(LCD controller) interface. The SPI Bus is usually used only on the PCB. The SPI Bus was designed to transfer data between various IC chips on the same PCB at very high speeds. Due to this high-speed aspect, the bus lines(The wires/traces or connections) cannot be too long, because the signal becomes unstable at longer distances . However, it’s possible to use the SPI Bus outside the PCB at low speeds, but this is not practical.
Serial Peripheral Interface protocol specifies 4 signal wires
- Master Out Slave In (MOSI) — This is the signal that is created by the master (aka processor) and is sent to the peripheral(s).
- Master In Slave Out (MISO) — Slave (peripheral such as a LCD controller) generates MISO signals and sends them back to the Master (Processor)
- Serial Clock (SCLK or SCK) – SCLK signal is generated by the Master to synchronize data transfers between the master and the slave. The goal is to have both processor and display set at the same time.
- Slave Select (SS) from Master to Chip Select (CS) of slave – SS signal is generated by Master. This selects which peripheral is receiving the signal from the processor. There can be multiple peripherals connected to one processor. There may be other naming conventions such as Serial Data In [SDI] in place of MOSI and Serial Data Out [SDO] for MISO