Arduino 24XX1025 EEPROM Library

The 24XX1025 EEPROM family uses the I2C bus to communicate with the uC making the chip straightforward to interface. If using Arduino it’s even easier thanks to the Arduino Wire library which hides the complexity of I2C bus setup. Using default settings on the Arduino UNO platform the TWI (the 2-wire Serial Interface) hardware uses 100kHz as I2C clock frequency. Extra configuration is required to speeding up the clock to 400kHz.

You can find the source repository and the usage examples here: or just download the latest version (master) clicking here.

NOTE: the library isn’t finished yet, but feel free to hack with the code …

The Arduino Wire library initializes the internal TWI hardware for using a 100kHz clock. One can change the default config recompiling the Wire library or adding a couple of lines of your sketches just after the Wire.begin() command:

#define TWI_FREQ_FAST 400000L
TWBR = ((CPU_FREQ / TWI_FREQ_FAST) - 16) / 2;

This library uses the latter approach to boost the data clock up to 400kHz. However, according to the ATmega328p datasheet (linked below) the Arduino Uno can’t use higher frequencies (i.e. 1MHz which is the 24FC1025 part standard rate) due to the hardware peripheral limitation.

While using the library the following layout is taken as reference:

The A0 and A1 pins are grounded (selecting the base address) while A2 is connected (as required by datasheet) to VCC (in this case Arduino 5V). The WP pin is also connected to ground allowing write commands to take place.