2017-08-12 11:03 AM
Hi
We are using the L151VC part (with 256 KB flash consisting of one bank) for a sensor logger applications. We roughly log 32 bytes of data at 50 Hz. We have partitioned the flash into 96 KB of code and rest 160KB for data.
I have a couple of questions:
1) write throughput: we ran an experiment to write to 160 KB of flash using the following operation: unlock , 4-bytes write, lock
Based on this experiment it is taking 197 sec, representing 4.8 ms/4 bytes write. Is this expected?
Using this result, I can estimate 30 ms for writing 32 bytes, which is much higher than what I was expecting.
2) bus stall: the documentation says during write to flash, code fetches cannot be performed (since we execute out of flash and read from flash during write to the same block leads to bus stall. This means that for each 50 ms duration, the processor execution is stalled for 30ms. Did I get this right?
thanks
ben
2017-08-12 12:38 PM
Shouldn't have to lock/unlock for every word, shouldn't have to toggle PG either.
The flash is not fast, degrades with age, timings should be in data sheet.
Processor cannot read (execute) and write/erase flash at same time, basically stuffs wait states at the processor (stalls). Run code/interrupts from RAM
2017-08-13 10:12 AM
Thanks. I noticed that half word, double word, half page all have same write latency (3.5ms). I think buffering data and writing in batches of half page (128 bytes) would be the way forward for us.
Also guatanteed write cycles is 10k which is plenty for us.
thanks