SPIEEP is an Arduino C++ class library for interfacing with Microchip 25LC-series SPI-accessible serial EEPROM memory chips.
- Developed on Arduino 0022
- Dependent upon SPI library
See ReadWrite for documentation on Reading & Writing your EEPROM using this library
See SleepMode for documentation on entering & exiting Sleep Mode on chips that support this.
See StatusRegister for documentation on reading & manipulating the status register.
See BulkErase for documentation on using the Chip Erase and Page Erase feature.
Supports most/maybe all Microchip 25AA/25LC-series EEPROM chips by specifying chip parameters on object creation.
- SPIEEP(int addrwidth, int pagesize, int totalsize); -- You provide Address width (bits), Page size and Total size (bytes). Address width must be a multiple of 8.
- Includes 25LC040/25AA040 (512-byte), which is odd in that it uses an 8-bit address but specifies its 9th address bit as part of the read/write instruction opcode.
- For this chip Address width = 8 bits, Page size = 16 bytes, Total size = 512 bytes; the library will look for this unique combination and enable 9th address-bit instruction support.
- Only tested on the 25LC512 so far. I will be purchasing a few other chips soon to test them out with this library.
SPIEEP eep(16, 128, 65536);
SPIEEP eep(24, 256, 131072);
SPIEEP eep(8, 16, 512);
Access advanced features of larger models (developed on the 25LC512)
- Page Erase
- Chip Erase
- Sleep mode
- Does not implement write protection at the moment
- This can be done manually by manipulating the status register
- Does not implement Segment erase
Rudimentary read/write single bytes
- Also read/write single pages
Efficiently read/write arbitrary amounts of data even across page boundaries
- Writes combine in a single command up to a page boundary, and repeat on subsequent pages as necessary to complete the operation. Only 1 rewrite cycle performed per page per write request. Greater longevity and quicker writes for bulky data.
Efficiently read/write other datatypes
- Supports int, long, float, double
- Addressing scheme adapted to reflect the size of the datatype used, e.g.:
- Long integer, address 0 = EEPROM address 0x0000
- Long integer, address 1 = EEPROM address 0x0004
- Long integer, address 2 = EEPROM address 0x0008
- Functions available to read/write datatypes while specifying an origin point for the alternate addressing scheme
- E.g. Long integer address 2, offset=0x0010 results in EEPROM address 0x0018
- Allows partitioning of EEPROM to store different arrays of different data types
Chip testing function
- Note: This is destructive, overwriting the last byte in the chip to verify write/read/rewrite/read operations succeed.
- Returns true or false defining whether the chip passed or not, does not provide any specific details about what failed.