cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX breaks SDMMC DMA transfert for FatFS using SD card

VBurs
Associate II

Hi,

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.

34 REPLIES 34
VBurs
Associate II

Additionnaly, i have found that the SDMMC breaks when i am using the buffer allocation in the TouchGFX configuration in CubeMx.

When i chose the option "by address" and specify an address at the end of the ram (the same adress where touchgfx allocates the single frame buffer), i can call "MX_TouchGFX_Init();" with no impact on the SDMMC. It is when i call the "MX_TouchGFX_Process();" that the SDMMC stops working correctly.

Martin KJELDSEN
Chief III

_Process(); enters the TouchGFX main event loop. Could be a timing/priority issue.

/Martin

VBurs
Associate II

I have suspected the same, it's easy to replicate, juste use a devboard with a LCD and have a TOuchGFX project active, then try to activate the SDMMC interface. I have tried it on the STM32F7508-DK and had the same issue.

Martin KJELDSEN
Chief III

​Have you tried to do any debugging on this project?

/Martin

VBurs
Associate II

Yes i have debugged the project enough to blame touchgfx for breaking the SDMMC. More than that, i have tried to set different NVIC priority for the DMA2D and LTDC needed by the TouchGFX without any impact.

UMote.1
Associate

Hi,

do you have any update on this issue? I'm facing exactly the same problem on a STM32F746G-Disco devboard!

Thanks.

Martin KJELDSEN
Chief III

No, i'll try to get around to trying this out on an F746G-DISCO board. Can you share the project you have for this board?

UMote.1
Associate

Attached is a test project.

Thank you in advance!

I will be needing the SDMMC very soon in my project as well. I will be using the F746 or the H735, but the solution will likely be the same in either case.

Thanks!!

Bob