Arduino and SPI Interface
SPI, or Serial Peripheral Interface is a full-duplex serial protocol for communicating with high-speed peripherals, such as microcontrollers. You can communicate with SPI devices and sensors via SPI interface on Arduino® boards using MATLAB® Support Package for Arduino Hardware. You can also use this interface to communicate between two microcontrollers. Typically, SPI devices has one controller device that controls all peripheral devices. The SPI library has three common pins that are hardwired and a dedicated pin for output.
SDI, receives data from the SPI peripheral device
SDO, which outputs data to the SPI peripheral device
SCLK, which outputs a serial clock signal to synchronize communications
CE, which enables and disables peripheral devices from the controller
Note
To create a custom SPI code, see Create Custom Arduino Add-On Library
Every SPI device implements SPI standards differently. Refer to the device datasheet to understand how your device will work. SPI Devices transmit data in four basic modes and control the clock phase and the clock polarity. For more information refer to the SPI standards documentation.
For more information on Arduino SPI devices, see https://reference.arduino.cc/reference/en/language/functions/communication/spi/.