Showing results for 
Search instead for 
Did you mean: 

STM32Cube_FW_F4_V1.18.0 + SDIO + FATFS R0.12c doesn't work

Roberto Roman
Associate II
Posted on December 02, 2017 at 16:56

I tried to use the FAT file system with a SD card and the SDIO protocol, but with the v1.18.00 of stm32Cube for F4 MCU's doesn't work correctly, I discovered the next issues.

1.-  Inside of the FATFS configuration if the DMA tamplate is enable this module doesn't work

2.-   BSP_SD_Init() isn't called nowhere endded I need to call manually after  MX_FATFS_Init().

3.- DMA template is mandatory if FreeRTOS is enable.

Now, this issues didn't watch in the version v1.17.00 of 

stm32Cube for F4. The same programe is funcional in this version but not in the v1.18.00. 

Any idea regarding this topic? Is necessary to enable the DMA module to work with the protocol SDIO ?

Feion Nin
Posted on February 06, 2018 at 19:09

I have been annoy by this problem for several days, and thank Roman very very much for that after i follow Roman's solution I fix my problem and the SD card with FATFS can work with dma in RTOS correctly.In addition, I think that the SD initialization code and queue creating code should add to the sd_diskio.c -> DSTATUS SD_initialize(BYTE lun), And the key is modify two function name:

void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)



void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)


Posted on February 12, 2018 at 18:08

Need to fix again some parts also on 4.24 version:

Rename following functions: 

From void BSP_SD_WriteCpltCallback(void)  to  void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)

From void BSP_SD_ReadCpltCallback(void) to void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)

Posted on February 25, 2018 at 18:57



I have tested with proposed configuration (

CubeMX version (4.24) and last STM32CubeF4 package version (1.19)

). With fix proposed by Roman it works, but without it works only in configuration without DMA.

When can we expect new update?)

ST Employee
Posted on February 26, 2018 at 10:52


The issue that is still being faced even with last STM32CubeMX version (4.24) will be reported internally again.

For those who look for a complete solution, please refer to guidelines suggested by


‌ in



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Steffen M
Associate II
Posted on April 09, 2018 at 23:08


it is sufficient to remove the __weak in the bsp_driver_sd.h file for BSP_SD_ReadCpltCallback and BSP_SD_ReadCpltCallback. The good thing is that this is persistent even when updating the project with CubeMX. The __weak in the header file is a known problem for quite a few frameworks.


When will CubeMX be updated to fix this issue? I took me quite a while to figure it out;

found that thread just when I discovered the problem by myself ... really annyoing.

As this is described for F4 it, I had it with STM32L4R9I.

Best regards