cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 FatFS SDIO DMA bug

pro100vald
Associate II
Posted on June 14, 2018 at 23:28

How to reproduce:

1) Use STM32Cube FW_F4 V1.21.0 (not tested on other versions)

2) Set up SDIO 1-bit mode with default parameters.

3)

4) Set up FatFS with SDIO driver

 with default parameters

.

5) Set 'Use dma template'=enabled for SDIO (this is critical, bug does not exist in 'disabled' mode).

6) You need a microsd with file longer than sector size.

7) Use code:

FATFS SDFatFs;

FIL TestFile;

UINT BytesRead;

uint8_t buffer[2048];

FRESULT res = f_mount(&SDFatFs, (char*)SDPath, 0);

if (res==FR_OK)

{

res = f_open(&

TestFile

, 'test.bin', FA_READ);

if (res != FR_OK)

while (1);

}

f_lseek(&

TestFile

, 4);

f_read(&

TestFile

, buffer, sizeof(buffer), &BytesRead);

😎 Result: first 498 byte read correctly, then byte offset jumps 4 bytes back (exactly the value, used in f_lseek) and next data is read with broken offset.

Temporary fix: 

1 REPLY 1

Bumping off my feed

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..