AnsweredAssumed Answered

f_write returns FR_DISK_ERR when trying to write large chunks

Question asked by APod on Dec 28, 2017
Latest reply on Jan 29, 2018 by Clive One

I'm working with the F7 microcontroller and MXCube v1.8.0 for the uC peripherals configuration. The sdcard interface is configured to use DMA for the RX and TX operations.

I can successfully open/close/read files, but when trying to write large chunks, i get into some issues.

I open the file with the rewrite flag.

The data that needs to be written is stored in the SDRAM, so i just send a pointer to the beginning of the data in the SDRAM, and the size (about 970KB) to the f_write function.

After a random amount of written data (can be 2KB and also 40KB), DMA transfer error is triggered, which results in the FR_DISK_ERR.

When updated the code to write the data in chunks of 512 bytes (loop of f_write with maximum size of 512), the full data is written successfully.


Any ideas what i am  doing wrong, or what might be the issue?


I did try the bug fixes for the FATFS, suggested here, but non of them solved the issue.