

The 25LC320 is a 32 Kbit (4K x 8) serial EEPROM manufactured by Microchip Technology. It is designed for non-volatile data storage, meaning it retains data even when power is removed. The component communicates using the SPI (Serial Peripheral Interface) protocol, making it suitable for applications requiring fast and reliable data transfer.








The following table outlines the key technical details of the 25LC320:
| Parameter | Value |
|---|---|
| Memory Size | 32 Kbit (4K x 8) |
| Interface Protocol | SPI (Serial Peripheral Interface) |
| Operating Voltage Range | 2.5V to 5.5V |
| Maximum Clock Frequency | 10 MHz (at 4.5V to 5.5V) |
| Write Cycle Time (tWC) | 5 ms (typical) |
| Data Retention | > 200 years |
| Endurance | 1,000,000 write/erase cycles |
| Operating Temperature Range | -40°C to +85°C |
| Package Types | PDIP, SOIC, TSSOP, MSOP |
The 25LC320 is typically available in an 8-pin package. The pinout and descriptions are as follows:
| Pin | Name | Type | Description |
|---|---|---|---|
| 1 | CS | Input | Chip Select: Activates the device when pulled low. |
| 2 | SO | Output | Serial Data Output: Outputs data during read operations. |
| 3 | WP | Input | Write Protect: Disables write operations when pulled low. |
| 4 | VSS | Power | Ground: Connect to system ground. |
| 5 | SI | Input | Serial Data Input: Receives data during write operations. |
| 6 | SCK | Input | Serial Clock: Synchronizes data transfer between the device and the controller. |
| 7 | HOLD | Input | Hold: Pauses communication without resetting the SPI bus. |
| 8 | VCC | Power | Power Supply: Connect to a voltage source (2.5V to 5.5V). |
Below is an example of how to interface the 25LC320 with an Arduino UNO to write and read data:
#include <SPI.h>
// Pin definitions
const int CS_PIN = 10; // Chip Select pin connected to Arduino pin 10
void setup() {
// Initialize SPI and Chip Select pin
SPI.begin();
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH); // Ensure CS is high (inactive)
Serial.begin(9600);
}
void loop() {
// Example: Write and read a byte to/from address 0x0000
writeEEPROM(0x0000, 0x42); // Write 0x42 to address 0x0000
delay(10); // Wait for write cycle to complete
byte data = readEEPROM(0x0000); // Read data from address 0x0000
// Print the read data
Serial.print("Read Data: 0x");
Serial.println(data, HEX);
while (1); // Stop the loop
}
// Function to write a byte to the EEPROM
void writeEEPROM(unsigned int address, byte data) {
digitalWrite(CS_PIN, LOW); // Select the EEPROM
SPI.transfer(0x02); // Send WRITE instruction
SPI.transfer((address >> 8) & 0xFF); // Send high byte of address
SPI.transfer(address & 0xFF); // Send low byte of address
SPI.transfer(data); // Send data byte
digitalWrite(CS_PIN, HIGH); // Deselect the EEPROM
}
// Function to read a byte from the EEPROM
byte readEEPROM(unsigned int address) {
digitalWrite(CS_PIN, LOW); // Select the EEPROM
SPI.transfer(0x03); // Send READ instruction
SPI.transfer((address >> 8) & 0xFF); // Send high byte of address
SPI.transfer(address & 0xFF); // Send low byte of address
byte data = SPI.transfer(0x00); // Read data byte
digitalWrite(CS_PIN, HIGH); // Deselect the EEPROM
return data;
}
No Data Read/Write:
Corrupted Data:
Write Operations Failing:
Q1: Can I use the 25LC320 with a 3.3V microcontroller?
A1: Yes, the 25LC320 operates within a voltage range of 2.5V to 5.5V, making it compatible with 3.3V systems.
Q2: How do I erase data on the 25LC320?
A2: The 25LC320 does not have a dedicated erase command. Data can be overwritten directly, but ensure the write cycle time is observed.
Q3: What happens if the power is lost during a write operation?
A3: If power is lost during a write, the data being written may be corrupted. Use a stable power supply and consider adding a capacitor to handle brief power interruptions.