adafruit / Adafruit_FRAM_SPI

Driver for Adafruit's SPI-Based FRAM Breakouts
Other
34 stars 30 forks source link

Increased logging speed #17

Closed KoalaBear27 closed 3 years ago

KoalaBear27 commented 3 years ago

I’ve been using the library for some time now, and it works very well. Thanks for that.

Using an Arduino Uno, I’ve been able to log 100bytes in 8’332 microseconds and using a Teensy 3.5 I’ve logged 100bytes in 3’342 microseconds, which is fine for most applications.

I would like to suggest an improvement to increase the logging speed. The fram.write8(uint16_t framAddr, uint8_t value) fonction writes 3 bytes (2 for the address and 1 for the actual value) each time I want to store 1 byte of data.

In my example, to log 100 bytes, I would need to send 200 additional bytes just to indicate the address. This causes the logging speed to be much slower than what it could be.

Could you add a feature that bumps X amount of bytes in row, starting at a user defined address and then automatically increment the address until X amount of bytes are saved ? Sort of like : fram.write8(uint16_t framAddr, uint8_t *value, sizeof(value))

Reply #15 of this post shows what I mean : https://forum.arduino.cc/index.php?topic=719031.0

Thanks for your help.

ladyada commented 3 years ago

did you try void Adafruit_FRAM_SPI::write(uint32_t addr, uint8_t *values, size_t count) on https://github.com/adafruit/Adafruit_FRAM_SPI/blob/master/Adafruit_FRAM_SPI.cpp#L192 ??

KoalaBear27 commented 3 years ago

Hi,

I didn't saw it initialy. This is exactly what I was looking for, and as expected it is indeed much faster than the regulard write8() function.

Thanks for your help.