Skip to content

sparkfun/SparkFun_External_EEPROM_Arduino_Library

Repository files navigation

SparkFun External EEPROM Arduino Library

SparkFun Qwiic EEPROM

SparkFun Qwiic EEPROM (COM-18355)

A simple-to-use I2C library for talking to any EEPROM. It uses the same template system found in the Arduino EEPROM library so you can use the same get() and put() functions.

Various external EEPROMs have various interface specs (overall size, page size, write times, etc). This library works with all types and allows the various settings to be set at runtime. All read and write restrictions associated with pages are taken care of. You can access the external memory as if it was contiguous.

Once the library has been started, the memory type needs to be set, the following is an example for the Qwiic 24xx512 EEPROM:

myMem.setMemoryType(512); 

Where 512 is the model (ie, 24LC512). Setting the memory type configures the memory size in bytes, the number of address bytes, and the page size in bytes. The following memory types are valid: 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1025, 2048

For a list of all the EEPROM datasheets, please see this repo. We don't want to store the PDFs in the library repo, otherwise, every user will have to download all the PDFs just to install the library.

Alternatively, the individual settings can be set. If setMemorySizeBytes/setAddressBytes/setPageSizeBytes() are called, they will overwrite any previous settings set by setMemoryType().

myMem.setMemorySizeBytes(65536);
myMem.setAddressBytes(2); // Set address bytes and page size after MemorySizeBytes()
myMem.setPageSizeBytes(128);

Set the memory type, or set the memory settings, but not both.

This library is best used with the Qwiic EEPROM.

This library can be installed via the Arduino Library manager. Search for SparkFun External EEPROM.

Want to help? Please do! We are always looking for ways to improve and build out features of this library.

Thanks to:

Repository Contents

  • /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
  • /src - Source files for the library (.cpp, .h).
  • keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
  • library.properties - General library properties for the Arduino package manager.

Documentation

License Information

This product is open source!

Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!

Please use, reuse, and modify these files as you see fit. Please maintain attribution to SparkFun Electronics and release anything derivative under the same license.

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.