I’m trying to test out using the Flashee library but I cant seem to get it working correctly. Basically all I want to do is create a rolling log of unit32_t numbers.
When I read I do no get the same value as what I am writing. My results are below.
Thoughts on what I’m missing?
thanks in advance.
#include "flashee-eeprom.h"
using namespace Flashee;
FlashDevice* flash;
void setup() {
flash = Devices::createAddressErase();
uint32_t testLog = 4222222222;
flash->write(testLog, 5);
Serial.print("write: ");
Serial.println(testLog);
delay(10);
Serial.print("read: ");
testLog = flash->read(testLog, 5);
Serial.println(testLog);
}
void loop{
}
My Results is:
write: 4222222222
read: 1
ScruffR
December 29, 2015, 9:29pm
2
Try flash->write((const void*)&testLog, 4);
and flash->write((void*)&testLog, 4);
instead.
@ScruffR , I update to below, now I get an error. I assume you meant flash->write((void*)&testLog, 4);
as flash->read((void*)&testLog, 4);
uint32_t testLog = 4222222222;
flash->write((const void*)&testLog, 4);
Serial.print("write: ");
Serial.println(testLog);
delay(10);
Serial.print("read: ");
testLog = flash->read((void*)&testLog, 4);
Serial.println(testLog);
ScruffR
December 29, 2015, 10:10pm
4
I see you were using other overloads than I was looking at, where your 5
was the address.
Sorry for the misunderstanding.
In this case try flash->write((const void*)&testLog, 5, 4); and flash->read((void*)&testLog, 5, 4); instead (again ).
And also check the return (bool
) of the two statements.
@ScruffR , how do I check the returns of the statements?
also tried the above, and I get the same results
uint32_t testLog = 4222222222;
flash->write((const void*)&testLog, 5, 4);
Serial.print("write: ");
Serial.println(testLog);
delay(10);
Serial.print("read: ");
testLog = flash->read((void*)&testLog, 5, 4);
Serial.println(testLog);
@wesner0019 , I’m going to ask a dumb question. Are you using a Core, a Photon or a P1?
@peekay123 , dumb questions don’t exist for me!
I’m using a P1.
@wesner0019 , less dumb question. Does flashee support the P1 as of yet?
@peekay123 , from the fit repo it says it’s been ported for the P1
@mdma , wondering if you were ever able to test the flashee-eeprom library on the P1? I’ve tried running the performace-profile.cpp example on my P1 but nothing is displaying on my serial screen. Even when I have the below in the setup.
I do have a connected SPI LCD. Could this be causing issues possibly?
void setup()
{
Serial.begin(9600);
delay(6000);
Serial.println("delay(2000)");
}
1 Like
RWB
January 1, 2016, 10:02pm
11
@mdma I also would love to know if Flashee is working on the P1 reliably yet since I may need to use it in the near future.