Today I pushed theinitial version of my FRAM library to github:
https://github.com/RobTillaart/Arduino/tree/master/libraries/FRAM
This class can be used to read write I2C FRAM. FRAM is non-volatile (keeps memory after powerdown) and it is faster than EEPROM. According to the datasheet they can work with 1Mb I2C (not tested yet).
Only tested with MB85RC256V (32KB 5.0V) with an Arduino UNO.
However the library is prepared for MB85RC512T (64KB 3.3V) and MB85RC1MT (128KB 3.3V)
Although this RAM memory cannot be accessed directly by the Arduino as more RAM, it allows one to have a sort of fast swap RAM which can be used for "fast big storage". Think of a large lookuptable, logging or to store a lot of text strings (menu?) e.g. in multiple languages. As the chip has 3 address lines one can put 8 of these FRAM chips on a I2C bus giving an Arduino a virtual memory of 256KB.
The interface shows it usage
FRAM();
int begin(const int address); // defaults to 0x50
void write8(uint16_t memaddr, uint8_t value);
void write16(uint16_t memaddr, uint16_t value);
void write32(uint16_t memaddr, uint32_t value);
void write(uint16_t memaddr, uint8_t * obj, uint16_t size);
uint8_t read8(uint16_t memaddr);
uint16_t read16(uint16_t memaddr);
uint32_t read32(uint16_t memaddr);
void read(uint16_t memaddr, uint8_t * obj, uint16_t size);
uint16_t getManufacturerID();
uint16_t getProductID();
uint16_t getSize() { return _size; };
begin(addr) initializes the object.
write8,16,32 and read8,16,32 are self explaining, in fact they are implemented with write() and read(). These latter can read / write objects of any size to the FRAM as it uses blocks that fit within one I2C request from the Wire library.
The getManufacturerID and getProductID are used to determine the size of the chip. The use of these is limited.
The library has one demo sketch that shows the usage of different functions.
As always, remarks, comments, improvements and ideas (e.g. demo sketches) are welcome