Also known as four-wire serial interface. The Serial Peripheral Interface BUS (SPI) has four wires: SCLK, MOSI, MISO, and SS.
- SCLK - serial clock line
- MOSI - master-out-slave-in data line
- MISO - master-in-slave-out data line
- SS - slave select line
SPI uses two shift registers to transmit and receive data.
Read and write a byte to SPI EEPROM (25LC040)
https://github.com/Ltran0325/MSP432-SPI-EEPROM/blob/main/main.c
25LC040 Datasheet:
http://ww1.microchip.com/downloads/en/devicedoc/21204e.pdf
Source: 25LC040 datasheet
- Pull CS low
- Send READ instruction byte
- Send lower address byte
- Send dummy byte to read data output (recieve and trasmit concurrently)
- Pull CS high
Source: 25LC040 datasheet
- Pull CS low
- Send WRITE instruction byte
- Send lower address byte
- Send byte to be written
- Pull CS high
Source: 25LC040 datasheet