Showing results for 
Search instead for 
Did you mean: 

TouchGFX breaks SDMMC DMA transfert for FatFS using SD card

Associate II


I have a STM32F779BI on a custom board that communicates with a LCD display using the LTDC interface in 16bits (480x272). I am using a single buffer inside the RAM of the MCU. So far TouchGFX works pretty well but once i activated the Software package for touchgfx inside Cubemx, i see that a "MX_TouchGFX_Init();" is added in the Main init section and i have to manually call the "MX_TouchGFX_Process();" in a task when all my board is up and running and can finally start the drawing process on the LCD.

My problem is that i have a task for logging data on a SD card using FatFS. Since i am using FreeRTOS, i had to implement the writes and Reads using the DMA on the SDMMC. This works pretty well too when touchgfx is not initialized ("MX_TouchGFX_Init();") and started ("MX_TouchGFX_Process();").

At first i thought it was a problem of NVIC priority for the SDMMC DMA versus the DMA2D interrupt priority. However, i made sure to give the DMA2D a priority less than for the DMA SDMMC and it still don't work.

The reason i know it's not behaving correctly is that FatFs return "FR_NO_FILESYSTEM" when doing a "f_open()". Normally, the FatFs generated by CubeMx does not need any modifications and if it breaks, is usually due to a lower layer (DMA transfer in this case).

Has anyone experienced problem with the Sdcard when using touchgfx in this communiation: SDMMC+DMA+FATFS+FReeRTOS+TouchGFX?

I have provided the project as is where you can look into my cubemx file for settings.

Thanks in advance for the help.

Chief II

With regards to that explanation then, is that something that we should implement manually before/after FatFS interactions? I'd have thought that level of D-Cache management would have been done by the FatFS library if it was necessary?

The D-cache maintenance code should not be in the generic library, but in the DISKIO driver for the specific platform. And, as in this case the driver is implemented by ST, it is a broken bloatware. Therefore the real answer is - toss out the code implemented by incompetent fools and replace it with a decent one.


i have read the documentation you provide in your post.

But unfortunately i have no succes for using TouchGFX + FATFS SDMMC on a stm32f746G-disco

i have also tried FatFs with USB HOST with the same result

did you have some working code that you want to shere here?

thank you



i know this post is from 2021 but i have the same issue now in the end of 2023


there is no an official ST solution at this issue? 

i'm unable to write to a file on SD card or USB disk if the touchgfx is used


i have tryed many solution provided in the forum but i 'm stuck on this project for weeks

thank you in advance if you have a working solution