Skip to main content
Visitor II
August 16, 2020
Question

FatFS and FreeRTOS error f_write().

  • August 16, 2020
  • 2 replies
  • 942 views

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

    Graduate II
    August 16, 2020

    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.

    AKuznAuthor
    Visitor II
    August 17, 2020

    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.