FATFS in nCS appears to be working synchronously?

I think FATFS in nrf5 SDK worked asynchronously. However, FATFS in nCS appears to operate synchronously.

I measured the time to write to the SD card using the k_cycle_get_32 API, and it takes about 5 milliseconds. (Write about 50k bytes, then flush with fs_sync API)

Reducing the number of data to be written or removing the fs_sync API will reduce the time required. This is proof of synchronous operation.

Why synchronous operation? Can I have asynchronous operation?

Parents Reply
  • Hi,

    I think it depends on the backend that is used but the module as a whole is considered blocking as it does several operations sequentially. 

    For nRF Connect SDK you can try to put the write operations into a work thread. But be aware that the module is not thread safe, so you'll have to implement your own thread safe handling by using mutex to make sure that other threads will not do any FATFS operations will another is already ongoing. The easiest way to do this is to make sure that all FATFS operations are handled by only one thread. 

    regards

    Jared 

Children
No Data
Related