I'm using this library: https://github.com/sosandroid/FRAM_MB85RC_I2C
Recording only a number or an array this all working perfectly.
But when trying to perform two recordings at different addresses, I have the impression that he always writes and read in the same position of memory.
My code:
#include <Wire.h>
#include <math.h>
#include <FRAM_MB85RC_I2C.h>
uint16_t writeaddress = 0x10;
uint16_t testaddress = 0x50;
uint16_t testaddress2 = 0x70;
//Creating object for FRAM chip
FRAM_MB85RC_I2C fram;
void setup() {
uint8_t readvalue = 0xFF;
Serial.begin(115200);
Serial.println("Starting...");
while (!Serial) ;
Wire.begin();
fram.begin();
byte result;
result = fram.readByte(writeaddress, &readvalue);
if (result == 0) Serial.println("Read Done");
if (result != 0) Serial.println("Read failed");
Serial.print("Leitura:"); Serial.println(readvalue, DEC);
result = fram.writeByte(writeaddress, 77);
if (result == 0) Serial.println("Write Done");
if (result != 0) Serial.println("Write failed");
result = fram.writeByte(testaddress, 44);
if (result == 0) Serial.println("Write Done");
if (result != 0) Serial.println("Write failed");
result = fram.readByte(writeaddress, &readvalue);
if (result == 0) Serial.println("Read Done");
if (result != 0) Serial.println("Read failed");
Serial.print("Leitura:"); Serial.println(readvalue, DEC);
result = fram.readByte(testaddress2, &readvalue);
if (result == 0) Serial.println("Read Done");
if (result != 0) Serial.println("Read failed");
Serial.print("Leitura:"); Serial.println(readvalue, DEC);
}
void loop() {
// nothing to do
}