Skip to content

Latest commit

 

History

History
62 lines (37 loc) · 1.69 KB

README.md

File metadata and controls

62 lines (37 loc) · 1.69 KB

MSP432-SPI-EEPROM

SPI Basics:

image

Also known as four-wire serial interface. The Serial Peripheral Interface BUS (SPI) has four wires: SCLK, MOSI, MISO, and SS.

  1. SCLK - serial clock line
  2. MOSI - master-out-slave-in data line
  3. MISO - master-in-slave-out data line
  4. SS - slave select line

image

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:

image

Source: 25LC040 datasheet

To read a byte from 25LC040:

  1. Pull CS low
  2. Send READ instruction byte
  3. Send lower address byte
  4. Send dummy byte to read data output (recieve and trasmit concurrently)
  5. Pull CS high

WRITE:

image

Source: 25LC040 datasheet

To write a byte to 25LC040:

  1. Pull CS low
  2. Send WRITE instruction byte
  3. Send lower address byte
  4. Send byte to be written
  5. Pull CS high

Circuit Setup:

image

Source: 25LC040 datasheet

image