Skip to main content
AKuzn
Associate
Aug 16, 2020 2:14 PM UTC
Question

FatFS and FreeRTOS error f_write().

Good day.

I am having difficulty with FatFS while working with FreeRTOS.

The problem is of the following nature. Mounting the distka goes well. There is no problem to create a file either. But when trying to write to a file, the f_write () function always returns FR_DISK_ERR.

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
Aug 16, 2020 7:26 PM UTC

Would recommend instrumenting the DISKIO layer to understand the interaction and failure.

Print out the fault codes from the SDIO/SDMMC layer.

Remember that the SDIO/SDMMC doesn't multi-task, you'll need some mutex or semaphore to gate ownership, and handle interrupts in a timely fashion.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
AKuzn
AKuznAuthor
Associate
Aug 17, 2020 6:47 AM UTC

Semaphore has already been created by CubeMX. DMA interrupt priority is lower than RTOS. Mounting a disk, creating a file and reading from a file goes well, but writing always returns FR_DISK_ERR.