I have an application where I must save chunks of data to flash memory. The flash memory used: https://datasheet.datasheetarchive.com/originals/dk/DKDS-24/460477.pdf
In the datasheet, it is mentioned that I cannot write to the page that has already been written ( even if it is half empty). I would like some advice regarding what is the best way to manage the writes to the memory?
- I am writing chunks of 25 bytes.
- Total page size is 256 Bytes
- Total amount of pages 16,384
- Smallest erase sector : 4KB (16 Pages)
My questions:
- The only way I can think of to manage the memory, is to have a 4KB buffer and everytime I want to write some data, read the last 16 pages of data and save it in the buffer. Then I CAN erase the sector and rewrite the previous data as well as a new chunk. Is this the most common practise? Are there any other better methods available?
The only other way I can think of is to simply write 1 chunk of data per page which sounds like a complete waste of memory. But considering that I have 16384 pages available, saving 16384 chunks of data might be more than enough for my application.
- Is it normal practise to use some asci character to signal the end of the chunk? For example using Decimal 13 (carriage return) as a seperator:
PAGE
[CHUNK1] 13 [CHUNK2] 13 [CHUNK3] ........
END OF PAGE
Appreciate all the help.