Closed sdetweil closed 1 year ago
well, part 1, DOAH, READ ... it uses flash and flash is wiped on firmware upload.. ...
now.. part 2, I'm not getting out what I put in..
do I have to commit after each write?, example says no
my read code
char xx[]="some string of dummy data";
if(EEPROM.isValid()){
Serial.println("config present");
Serial.println("using stored data");
// create a buffer
char x[sizeof(xx)+10];
// clear it, expect we will read less data than buffer size, most of the time.
memset(x,0,sizeof(x));
// loop thru the eeprom (whatever it is)
for (int i=0; i<sizeof(xx)+10; i++) {
Serial.print(" ");
// get a character
unsigned char y = EEPROM.read(i);
// if its not a null terminator (c stringish)
if( y != 0){
// save it in the buffer
x[i]=y;
}
// done with the read loop
else
break;
}
}
only 25 chars of my 110 chars are retrievable from flash on my Nano 33 IOT i write ascii chars and then '\0', and then commit() I read til I see the '\0'
ok, don't know why, but it thinks there is a '\0' embedded in the data, but not..
anyhow, now write 1 byte length, rest of data read 1 byte length, rest of data..
all ok
i am trying to the the eeprom emulation (I guess?) https://github.com/cmaglie/FlashStorage/blob/master/examples/EmulateEEPROM/EmulateEEPROM.ino
EEProm.read/write/isValid()
compiles ok, just always reports isValid = false
is this the right function to use?
I REALLY don't CARE HOW its done... name, address, location,, whatever flash, eeprom, stones in a cup.
the example doesn't say it wont work on this board.. and the lib says it supports samd21 and 51
this is a json string with variable length elements, I can imagine a max length..