Flash memory #620
Replies: 2 comments 5 replies
-
A flash page is 4096 bytes. The limit of flash isn't the number of writes, but the number of erases. Your 10 byte string will fit 409 times into a single page after a single erase. If the limit is 10,000 erases, you can reliably write about 4,000,000 values to a single page. You have a 100 KB file, which is 25 pages, so it would be 25 * 4,000,000 = 100,000,000 values written. The number of erases is likely higher. It depends on the chip. Also, SPIFFs can be configured for wear-leveling, which avoids reusing the same page so that the erased are spread out, when there is free space. |
Beta Was this translation helpful? Give feedback.
-
You wrote the file in parts. You can read the file in parts too. The documentation for the Files module explains the relevant APIs. Our book has sections on "Reading Text in Pieces" (Page 229) and "Reading Binary Data in Pieces" (page 231). It also has "Getting File Size" (page 228). Your code to read the file as a String fails because you pass only a single argument, which means "read the entire file." Instead of This code following your trace(buffer7[0] + "\n") That is because x = new ArrayBuffer(10);
console.log(x[0]); You cannot read the content of an let view7 = new Uint8Array(buffer7));
trace(view7[0] + "\n"); |
Beta Was this translation helpful? Give feedback.
-
This is my code:
let file = new File(config.file.root + "test.txt", true);
file.position = 0;
file.write("0123456789");
file.close();
in next instruction I will change the file.position = 10 and so on....
The flash memory has a number of writing of about 10.000 times. (I don't understanf if for Block Size, Page Size or single location).
This is my question:
How many cycles of writing (of 10 byte) can I do if the my SPIFFS file system if about 100kB ?
every string is 10Byte
so before to complete the memory = 100.000 : 10 = 10.000
10.000 * 10.000(cycles of life) = 10.0000.000 .
Is it correct ?
Beta Was this translation helpful? Give feedback.
All reactions