Thanks, this the info I needed.
about your update, the file name is just an example.
regards,
Marcus
Thanks, this the info I needed.
about your update, the file name is just an example.
regards,
Marcus
Hi @bko
Writing and reading to/from flash using the sFLASH_ APIās is not working when the number of writes is more than once. The first write and read work, but when I rewrite to the same address and read again, I read wrong values (mostly zeros).
I have put delay(100) between the reads and writes, and I have erased the sector (in setup() ) and I am writing even number of bytes( 8).
Is there something I am missing? Is there another way?
Hi @Muez
The FLASH technology only allows writes to convert 1ās to 0ās, so if you have ever written a location with 0ās in the value, you need to erase before you can write 0ās again. There are lots of schemes to work with this limitation so you donāt have to erase so often.
Does that explain your results or is your problem different?
I see,
One solution I can think of for my case is not writing to the same memory location again.
I want to log some data, so I don't need to rewrite to the same address.
Good.
Hi @Muez. There this library https://community.spark.io/t/user-nvm-non-volatile-memory-support-with-the-serial-flash/2765 created by @mattande - maybe that will help you?
If you can hang on a few days, Iām in the middle of coding a library to specifically support logging data to flash via circular buffers. And also an eeprom emulation layer so you just read and write as normal - meaning you can write to the same address twice without any issues.
Hi,
I have made a simple file system for the spark, silly and simple. I have not setup a git account jet, so here are the links to the sfs.cpp and the sfs.h
cpp file: http://pastebin.com/WreFALxV
h file: http://pastebin.com/CNL6TQQG
āmanualā is at the beginning of the files.
example:
//create a file:
fs.create((char*) "index.htm");
fs.append((char*) "hello world!\n");
fs.append((char*) "a brave new world!");
fs.close();
//read a file:
if (fs.open((char*) "index.htm")) {
while (fs.read(buffer, 120) > 0) {
Serial1.println(buffer); //do something more suitable for your app
}
fs.close();
}
//dir command: slightly more complicated.. you have to loop through the directory and collect each entry in a buffer.
int index = 0; //
char buf[45];
int rc = 0;
Serial1.println("dir:");
while (index < 17) {
rc = fs.dir(buf, &index);
if (rc != 0)
break;
Serial1.println (buf);
}
enjoy!
Hi @ marcus,
the links are both the same header file.
Sorry, it was late last nightā¦
I changed the content.
the function erase_file is under development, as we speak, so be careful!
I hope you can work with it,
bye!
Cool! Thanks for sharing!
Thanks,
David
no prob, it does not beat DOS, but it works.
Iām on the hunt for freeing up RAM, and one of the entries near the top of the list is
00000200 b EepromAddressTab
This is part of the eeprom emulation layer. Given that it only emulates 100 bytes, I was surprised to see the ram usage was twice that!
What I donāt understand is why the app takes the hit for this memory even if they donāt use EEPROM. I thought the linker garbage collected unused functions and data?
been digging through posts concerning the use of the external EEPROMā¦seems like youāve been able to use it successfully without interference from the wifi module on the SPI bus that others were struggling with. Whats the secret? Iād like to use the external eeprom to host files for an embedded webpage.
I hadnāt solved that problem until recently. Iāve posted a fix at https://github.com/m-mcgowan/core-common-lib/tree/spibus_arbiter - this ensures that the flash and the cc3000 donāt collide with their use of the internal spi bus. You donāt have to change your code - itās part of the firmware (at least when you pull the changes in that repo - but keep in mind thatās preproduction code and also includes local changes I had to make to makefiles to work on my Windows box.)
Itās discussed in this thread - https://community.spark.io/t/bug-bounty-ota-flash-reliability-issue/
Thereās another approach involving turning off interrupts, but thatās a pretty blunt tool in comparison to precision of the device (a mutex lock) that I use.
interesting read. Kinda of surprising that the OTA flash works as well as it does without the arbiterā¦youād think that would represent a pathological use caseā¦simultaneous access of external flash and wifi.
I know. I think there must be sufficient latency in the system not to exacerbate the problem. But clearly itās become more of a pressing issue.
To be perfectly honest, Iām surprised a shared bus was put in place without any access control from the outset, but of course we donāt know what other battles the team have fought to get this far.