This article discusses the SPI bus functionality of the Arduino framework for use with the STM32F030F4P6, STM32F103C8, STM32F401, esp8266 and esp32. The operation of this bus requires at least 3 intercommunication cables: SCLK, MISO. and MOSI for transmitting the clock signal between the sender and the receiver. It serves to receive information from the sender. and used for sending information to the recipient.
From the use of 3 signal lines, it is found that data can be transmitted and received simultaneously. This is different from I2C bus communication that uses only one SDA cable to communicate. At the same communication speed, the SPI bus will receive and transmit data without waiting for an idle line, while I2C will have to wait for idle. With this in mind, SPI can send/receive data faster.
In addition, SPI uses a method to select the destination to communicate by instructing the endpoint to know by sending a signal to the SS pin of the terminal. Therefore, when connecting to multiple devices, SPI requires a larger number of pins to operate, while I2C uses device identification to communicate with each other by still using only one SDA cable, which saves more pins.Read More