MSP432-SPI-EEPROM
SPI Basics:
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.
SPI EEPROM Operation:
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
READ:
Source: 25LC040 datasheet
To read a byte from 25LC040:
- 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
WRITE:
Source: 25LC040 datasheet
To write a byte to 25LC040:
- Pull CS low
- Send WRITE instruction byte
- Send lower address byte
- Send byte to be written
- Pull CS high
Circuit Setup:
Source: 25LC040 datasheet