I am working on an embedded app on the Tiva microprocessor platform. Its disk is an MSD accessed via SPI and using the open source FatFs provided with the StellarisWare software package.
My app has to write data to disk at a fairly brisk rate, about 60KB per second, for up to 4 hours at a stretch. Every few seconds I sync the disk to ensure that most of the file being written is retained even in the event of power failure or the app stopping for some reason,
Inevitably there are I/O errors in that time and I am looking for the best strategy for dealing with them. Currently I try to close the current file and open a new one to carry on. However the file close sometimes fails, usually with a generic R/W error. Simplistic retries of the action do not yield the desired result.
I'm sure there are learned treatises on the best strategies but after hours of Googling I've yet to see a practical guide.
Your ideas are most welcome, especially if proven on a platform similar to mine.