Serial Peripheral Interface (SPI)
SPI communication is an onboard synchronous communication method and is used by a number of
devices including sensors, TFT displays, GPIO expanders, PWM controller ICs, memory chips, addon
support devices, etc.
There's always one master device in a SPI communication bus which generates clock and select
slave(s). Master sends commands to slave(s). Slave(s) responds to commands sent by the master. The
number of slaves in a SPI bus is virtually unlimited. Except the chip selection pin, all SPI devices in a
bus can share the same clock and data pins.
Typical full-duplex SPI bus requires four basic I/O pins:
•
Master-Out-Slave-In (MOSI) connected to Slave-Data-In (SDI).
•
Master-In-Slave-Out (MIS0) connected to Slave-Data-Out (SDO).
•
Serial Clock (SCLK) connected to Slave Clock (SCK).
•
Slave Select (SS) connected to Chip Select (CS).
In general, if you wish to know more about SPI bus here are some cool links:
•
https://learn.mikroe.com/spi-bus/
•
https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi
•
http://ww1.microchip.com/downloads/en/devicedoc/spi.pdf
•
http://tronixstuff.com/2011/05/13/tutorial-arduino-and-the-spi-bus/
•
https://embeddedmicro.com/tutorials/mojo/serial-peripheral-interface-spi
•
http://www.circuitbasics.com/basics-of-the-spi-communication-protocol/
STM8s have SPI hardware that are more capable than the SPI hardware found in other micros. An
additional feature of STM8's SPI is the hardware CRC. This feature ensures reliable data
communication between devices.
Need help?
Do you have a question about the STM8 and is the answer not in the manual?
Questions and answers