Go Down

Topic: FRAM library published (Read 3649 times) previous topic - next topic


Jan 24, 2018, 02:22 pm Last Edit: Jan 24, 2018, 02:23 pm by robtillaart
Today I pushed theinitial version of my FRAM library to github:


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
Code: (public part of FRAM.h) [Select]

  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

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)



I'm curious about your reasoning for using "Uncategorized" for the category property in library.properties. It seems like there are one or two specific categories that are appropriate.

Obviously this isn't a big deal. I ask only because I see Uncategorized used fairly often and am interested in the motivations people might have for this.

I realize some libraries just don't fit nicely into a category and the specific meaning of the categories is not documented but there is always "Other" to fall back on so I don't understand why Uncategorized gets used. Maybe it means "I haven't gotten around to choosing the category yet"?


Copied a template :)
so I need to update that to Storage. .... done

added a performance test sketch to see how the FRAM performes.

Code: (shortened output) [Select]
CLOCK: 100000
WRITE 100 bytes TIME: 11 ms
READ 100 bytes TIME: 12 ms

CLOCK: 200000
WRITE 100 bytes TIME: 7 ms
READ 100 bytes TIME: 7 ms

CLOCK: 400000
WRITE 100 bytes TIME: 4 ms
READ 100 bytes TIME: 4 ms

CLOCK: 600000
WRITE 100 bytes TIME: 3 ms
READ 100 bytes TIME: 3 ms

CLOCK: 800000
WRITE 100 bytes TIME: 2 ms
READ 100 bytes TIME: 2 ms

CLOCK: 900000 ==> fails

Quite ok imho
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)



I know this has been posted a while ago, but I just wanted to know if this library is compatible with Cypress Semiconductor's FRAMs like the FM24CL64B (http://www.cypress.com/file/41656/download).

I just bought a couple of them in AliExpress and they are on their way now.


Go Up