Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

How to choose the correct value for FAT_FS__CACHE_FLUSH_TIMEOUT_USEC? #530

Open
doingnz opened this issue Dec 7, 2016 · 0 comments
Open

Comments

@doingnz
Copy link
Contributor

doingnz commented Dec 7, 2016

FAT_FS__CACHE_FLUSH_TIMEOUT_USEC is #define FAT_FS__CACHE_FLUSH_TIMEOUT_USEC (6010001000) in FAT_FS.h. In the Windows platform_selector this default is over ridden to 5 seconds.

Its primary purpose appears to be to Enqueue a callback to FlushAll() after the timeout in FAT_SectorCache.cpp

    if(forWrite)
    {
        cacheLine->SetDirty( TRUE );

        if((FAT_FS__CACHE_FLUSH_TIMEOUT_USEC) != 0 && !m_flushCompletion.IsLinked())
        {
            m_flushCompletion.EnqueueDelta(FAT_FS__CACHE_FLUSH_TIMEOUT_USEC);
        }
    }

Why is 60 seconds selected? (or 5 for Windows)

Can one use 100 milliseconds or even shorter? Risks?

Can one safely cancel a queued call to FlushAll if the application explicitly calls FlushAll?

I am trying to avoid these unscheduled calls to FlushAll() as I need to avoid unexpected use of the SPI bus when the application is using it for other purposes. I have an SD card attached to the SPI bus and my application called FlushAll after it modified the files on the SD card.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant