How do I force a Rabbit module to load the FAT partition from Flash at start-up and discard the cached copy in RAM?

The cached copy in RAM sometimes goes bad, even when the data on Flash is still good.

I know there is a whole procedure to go through to properly dismount a FAT drive, but this is not always possible.

A power failure, watchdog reset, debugger restart or simply a code crash often causes the FAT partition to go bad. I find that most of the time it’s just the cached copy of the FAT partition that goes bad and not the actual data on the Flash.

Certain files would just disappear off the partition and in some cases all the files.
If I remove all power from the device, including the battery backup, then the FAT drive usually comes back fine.

How do I force the Rabbit to always load the Flash on start-up, rather than to assume the cached copy in RAM is good?

I never had this issue on a Rabbit 2000, but I’m having a lot of issues on the Rabbit 6000.

Also, every time I write something to the Flash, which I can’t afford to loose, I have to dismount and remount the FAT partition, just to force the cache to write to Flash.

I know the caching is to prevent wearing out the Flash, but I wish there was a way to completely disable caching.
That would also free up some much needed BBRAM…

Any help would be greatly appreciated!

You should look at the function fat_SyncPartition()
This is similar to periodically saving a file that you are adding to on a pc.
You can add this to your program as needed to flush the cache to the FAT filesystem .

Be careful of the number of calls to this function because it is writing to flash which has a limit on the number of writes.