AT25xxx SPI EEPROMs (incl. M95xxx, 25AAxxx, 25LCxxx, CAT25xxx, BR25Sxxx)


The AT25 (About Modules) module interfaces to an SPI EEPROM that uses 2 bytes for the address. The table below shows the Atmel part numbers that this module should be compatible with, and the appropriate parameters for them. There are also pin compatible EEPROMs available from many other manufacturers, including the M95xxx (ST Microelectronics), 25AAxxx/25LCxxx (Microchip), CAT25xxx (ON Semi), BR25Sxxx (Rohm) (in all cases, the xxx is the size of the part, in kbits. For 32 and 64 bit, xxx is 320 and 640 respectively). Parts are available in DIP-8, SOP-8, and TSSOP-8. All of these parts should work equally well with this module. This module is also compatible with SPI FRAM modules that use the same protocol; these do not use pages, so specify pagesize as 0.

The I2C version of these EEPROMs, the AT24 series, is often more convenient to use, needing only 2 wires for I2C, while this requires 4 (3 for SPI and the CS pin); breakout boards and modules for AT24 series are also readily available. However, if integrating this into something where SPI is already in use, it will only require 1 extra wire for CS. Also, these parts can be used with software SPI, allowing it to be used with any pins, not just those supporting hardware SPI.

Part Size (kbit) Size (kbyte) Page size
AT25320 32 4 KBytes 32 bytes
AT25640 64 8 KBytes 32 bytes
AT25128 128 16 KBytes 64 bytes
AT25256 256 32 KBytes 64 bytes
AT25512 512 64 KBytes 128 bytes

This module is not compatible with EEPROMs with a capacity of less than 32 kbit, as these use a different addressing scheme. These use a 2 byte address to specify memory locations (with the appropriate number of most significant bits being ignored on smaller EEPROMs).


Connect Vcc and Hold to +3.3v (or VBat if VBat is 5v or less), GND to GND, SCK, SO and SI to SCK, MISO and MOSI SPI pins, and CS to any GPIO pin. WP should be connected to Vcc unless you want to write protect the EEPROM.


Setup I2C, then call:

var eeprom=require("AT25").connect(spi, pagesize, capacity, cspin)

spi is the spi bus.

pagesize is the page size for page writes. 0 for devices with no pages (like FRAM).

capacity is the eeprom capacity, in kbits.

cspin is the pin connected to CS.

Reading and Writing

These support the same interface as the I2C (AT24) and OneWire EEPROM modules,bytes,asStr)

read() reads the specified number of bytes, starting at the specified address.


write() writes the supplied data to the specified address. The data can be a string or an array of bytes. Address may be undefined, in this case, it will read from where last read ended (don't use that if the last operation was a write). This handles breaking the write up into pages, and waiting for the write delay period. The write delay is 10ms per page (This means that large writes can be quite slow). There is no delay when pagesize is 0.

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.