AnsweredAssumed Answered

Importance of flash cache when writing to program flash

Question asked by d p on Jun 9, 2020
Latest reply on Jun 25, 2020 by Omar Anguiano

I am trying to erase, write and read a section of the program flash on the FRDM-K66F while performing other operations. This is so that I can perform firmware upgrades in the background. The program flash is partitioned so that the partition to be programmed is different to the partition that holds the running program's code and data.

 

To achieve this, I am reading through the pflash driver example so that I may understand what is necessary to write to flash. However I am having trouble determining the importance of the flash cache in this example. My understanding is that the cache is, by default, used for speeding up the reading of code and data from the flash. It then appears as if the example turns this off using

FTFx_CACHE_ClearCachePrefetchSpeculation(&s_cacheDriver, true);

probably so that it may use the cache for itself.

 

Since I wish to write to the flash in the background, would it be better to leave the cache in its default state, so that the performance of the main program is not altered? Is this possible, or is it mandatory to use the flash cache when programming the flash?

Outcomes