Hello!
I have a question about writing to the internal 16k flash of my HS08JM16. The life cycle count is 100k. My project is to take accelerometer data for about 5 seconds, then save it to the flash. I've been doing some research and have found erase commands and also a byte write command. However, if one set of data is 1kb, and if I have to do single writes to the flash, does this mean that my flash will only last 100 runs? Is there a way to program a whole page of data? Any and all information with regards to writing multiple bytes to the flash and if there is a way to write more than one byte at a time would be appreciated. If I can write all 1kb to the flash in 1 write cycle, that would be the best scenario.
Thanks!
David
dinewby88, I would recommend implementing a wear-leveling algorithm. Your accelerometer is probably SPI or I2C, right? Which is going to be a single byte or data? Keep track of the position in your flash sector, writing the latest byte after incrementing a sector pointer. When you get to the end, erase the sector, and start over.
You are correct. It is an I2C accelerometer. What is this "wear-leveling" algorithm? The accelerometer will be outputing approximately as follows:
20 samples/second
5 second run
2 bytes/data point
3 axis
=600 bytes of data at a time.
Is it just keeping track of the location in the flash sector?
I also want the capability of saving multiple runs in the flash so the user can pull the data from multiple runs.
Hi Dinewby88,
Here is some perspective:
Each byte will only be written once until it can be read-out by the user. I expect that the user has to attach your device to some USB port to accomplish the read-out.
So if your user does that proceedure 13 times a day, 7 days a week, the flash is still going to last over 20 years.
Hello David, and welcome to the forum.
The flash life cycle is based on the number of erases for each flash sector. Of course, each byte within a sector may be programmed only once after each erase, but it is not necessary to use burst programming of consecutive bytes. Individual bytes may be programmed in any sequence.
With burst programming, a single row may be sequentially programmed, and is marginally faster than byte-by-byte programming. However, it is more complex, and you need to consider the position of each row within the sector, and you are still only programming one byte at a time. The difference is that the internal programming voltage remains active for the whole burst, rather than being lowered between bytes.
With 1KB of non-volatile data, this will occupy two flash sectors for most HCS08 derivatives.
Regards,
Mac