lipoyang / FRAM

FRAM library for Arduino
Apache License 2.0
1 stars 0 forks source link

Fram #1

Open scalak-s opened 1 week ago

scalak-s commented 1 week ago

Hi Bizan Nishimura .

I have trobles with your FRAM library.

I use MB85RS64V 8kB SPI FRAM wired to ESP32.

At the beginning all seemed to be fine but next heapend something strange. When I write few variables one after one I recived only last written value.

For example my code:

include

include

FRAM fram(8);

define SCK 5

define MISO 2

define MOSI 0

define CS 15

SPIClass spi = SPIClass(VSPI);

void setup() { Serial.begin(115200);
spi.begin(SCK, MISO, MOSI, CS); fram.begin(15, spi, 4000000); fram.put(30, 200); fram.put(40, 123); }

void loop() { byte a = 0; byte b = 0;

fram.get(30, a); fram.get(40, b);

Serial.println(a); Serial.println("-------"); Serial.println(b); Serial.println("========="); delay(1000);

}

When I run this code I recive only this:

123 // instead 200

123

Am I doing something wrong or my memory is damaged or maybe something else.

Even yor example FRAM_test1.ino code return something like this:

name: - //here is wrong height: 5.84 age: 45 Done!

I will grateful for your answer

scalak-s commented 4 days ago

Hi again.

I made an experience.

First I put two variables from your code:

double height = 5.84; uint32_t age = 45; fram.put(30, height); fram.put(40, age);

Then I read right values 5.84 and 45.

When I added the third instruction put:

double height = 5.84; uint32_t age = 45; uint8_t val1 = 100; fram.put(30, height); fram.put(40, age); fram.put(50, val1);

after reading it with get I obtained: 5.84 100 100