4 ms·
I didn't read enough of the post to get the context, but... You might often want to write less than a full block. In that case, if you always erase, you have t
by toast0 6y ago
I didn't read enough of the post to get the context, but...
You might often want to write less than a full block. In that case, if you always erase, you have to read the full block to ram, make your change, then erase, then write the full block. If you write byte by byte, that's a lot of erase cycles. So you add a check to see if the bytes you want to write are already in the erased state. But it's not much more work to check if the desired state is attainable instead of just if the current state is erased. Isn't it just if Current & New == New?
- jlokier 6y agoThat area full of 1s might not be really erased, though, if power was removed or the device reset during an erase cycle before. Those would be partially-charged cells, and should be erased properly before writing, lest you start getting temperamental read errors later. But repeatedly erasing blocks just to add a byte will wear out the block, as well as take a long time as you point out. I think the solution to these two constraints is filesystem-like book-keeping of which regions are in which states.
- __cuervo 6y agoThat's a risk, yes. For our use case, there is very strict error checking/firmware signature verification on every process involving the flash, so the corruption case is always handled gracefully, leading to a full erase anyway.