emFile V3.22: Data dumps (FS_Writes) at 36ms intervals sometimes misses up to 6 dump intervals.

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • emFile V3.22: Data dumps (FS_Writes) at 36ms intervals sometimes misses up to 6 dump intervals.

      The Issue
      I'm trying to dump binary data to a file every 36ms. Most of the time the SPI phase of the data dump is about 14ms of the 36ms. Sometimes it takes longer. There are a few times where the SPI phase is taking as long as 199ms. Once the FS_Write() operation takes longer than 36ms, there is a potential loss of data.
      I placed a framing pulse around the FS_Write(). Using the framing pulse we can see the FS_Write() is a blocking function. Is there an non-blocking FS_Write() function?
      Is it possible that the caching is causing this issue?
      I noticed in the release notes that the caching API calls to control cache characteristics were removed in V3.14. Therefore I cannot seethe cache API calls mentioned in the “UM02001_emFile_V322c.pdf”.

      The goal here is to find a way to store the binary data to the SD card a a constant rate without loss of data. If this is a caching reclamation issue, is there a way to minimize caching effects?

    • Hello Len,

      The write latencies your application is experiencing are probably related to some internal operations performed by the SD card such as wear leveling or garbage collection. emFile does not have any influence on the timing of these operations. All the file system operations are blocking which means that an API function returns only when the operation is completed. Currently, emFile does not support non-blocking operations. You can try to reduce the write latencies by configuring a sector cache in write back mode (FS_CACHE_MODE_WB) You can find a description of the cache API functions in the section "Optimizing performance - Caching and buffering" of the emFile manual.

      Best regards,