This is my first time posting to this forum so very grateful for any help / advice you can give for a datalogging application:
Suppose we want to save the last say 2 weeks of data to the File System (for periodic serial download / data backup) ~= 4000 samples, each less than 250 bytes in length.
[I also plan to maintain a queue of maxLength 400 samples for (synchronously controlled) cloud publishing, but I don’t think this is especially relevant to this query]
I am wondering how much my design choices might impact a) flash wear and b) if relevant, power consumption – or whether I can rely on Little FS to optimize it all regardless.
I’ve read some of the prior posts such as:
but still have some questions. Could anyone help educate me re the following?
- Is there any benefit to storing each sample in a separate file (similar to the approach used in SequentialFileRK and PublishQueuePosix) versus storing each sample in a large single file / circular buffer?
- SequentialFileRK appears to number and increment filenames infinitely(?) Is there any disadvantage to re-using or overwriting old filenames eg. a circular buffer of filenames?
- In general, does repeatedly writing fresh data to one specific filename increase the wear on one particular flash sector?
- In general, does repeatedly writing fresh data to one specific location within a given file increase the wear on one particular flash sector?
- Is there any wear associated with renaming files if otherwise leaving their contents unchanged?
- Sectors are 512 bytes long. Is the wear associated with overwriting 1 byte the same as overwriting 512 bytes?
- Is there any benefit to saving more data? If instead of saving 4000 samples (either in a single circular buffer file or in 4000 separate files) we only saved the last 40 samples, then these specific files (or specific locations within a single file) would be written to 100 times more often. Would this cause more wear or does Little FS take care of leveling this across all as-yet-unused sectors?