list of products from Amazon (Not mine, i just link them!) Scroll Down For Article! Note: Elegoo boards are not Arduino, but they are compatible with Arduino IDE and are mutch more affordable!
Project Description: EEPROM SPI Communication with Arduino
In this quick tutorial, we'll explore how to communicate with an EEPROM (Electrically Erasable Programmable Read-Only Memory) using SPI (Serial Peripheral Interface) with an Arduino. The project utilizes the SPI library to enable writing and reading data to and from the EEPROM, demonstrating a practical use of non-volatile memory.
Requirements
- Arduino Uno.
- 25AA160A EEPROM.
- Breadboard and jumper wires.
- SPI communication enabled on the Arduino.
Features
- Write data to the EEPROM.
- Read data back from the EEPROM.
- Display the data in the Serial Monitor.
The 25AA160A EEPROM has both a Write Protect (WP) and Hold (HOLD) pin. Here's how these pins are used and connected:
Write Protect (WP):
- The WP pin is used to prevent accidental writes to the EEPROM.
- When WP is connected to GND, the write protect feature is disabled, and writing to the EEPROM is allowed.
- When WP is connected to VCC, the write protect feature is enabled, blocking write operations to the EEPROM.
Hold (HOLD):
- The HOLD pin is used to pause communication without terminating the current SPI transaction.
- When HOLD is connected to GND, the communication is paused.
- When HOLD is connected to VCC, the communication operates normally.
EEPROMPin | Arduino Uno Pin | Description |
---|---|---|
CS | Pin 10 | Chip Select (Active Low) |
SCK | Pin 13 | Serial Clock |
SI | Pin 11 | Serial Input (MOSI) |
SO | Pin 12 | Serial Output (MISO) |
#define WRITE_ENABLE 0x06
: This command enables write operations on the EEPROM. Before writing any data, this command must be sent to allow the EEPROM to accept write instructions.
#define WRITE_DISABLE 0x04
: This command disables write operations. It prevents further write commands from being executed, ensuring that no accidental overwrites occur.
#define READ_DATA 0x03
: This command is used to read data from the EEPROM. When sent, the EEPROM returns the data stored at the specified address.
#define WRITE_DATA 0x02
: This command initiates the writing of data to the EEPROM. It must be followed by the target address and the data to be written.
#define RDSR 0x05
: This command reads the status register of the EEPROM. The status register contains information about the current state of the EEPROM, such as whether it is busy or ready for the next operation.
#define WRSR 0x01
: This command writes to the status register. It allows modifications to specific settings within the EEPROM, such as configuring write protection
0 Comments