Skip to main content
VBurs
Associate III
November 12, 2020
Question

TouchGFX breaks SDMMC DMA transfert for FatFS using SD card

  • November 12, 2020
  • 20 replies
  • 12832 views

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.

20 replies

VBurs
VBursAuthor
Associate III
November 12, 2020

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
Principal III
November 18, 2020

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

/Martin

VBurs
VBursAuthor
Associate III
November 18, 2020

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
Principal III
November 19, 2020

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

/Martin

VBurs
VBursAuthor
Associate III
November 19, 2020

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
Visitor II
December 17, 2020

Hi,

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

Thanks.

Martin KJELDSEN
Principal III
December 18, 2020

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?

Bob Bailey
Senior
December 19, 2020

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

UMote.1
Visitor II
December 18, 2020

Attached is a test project.

Thank you in advance!

CForo.1
Visitor II
March 15, 2021

Hello,

I use a STM32F746G-DISCO and i have a similar problem.

My program uses FreeRTOS + SDMMC + FatFS + TouchGFX, when using RTOS and TouchGFX, FatFS functions don't work properly.

I'm trying to find a issue.

Martin KJELDSEN
Principal III
March 16, 2021

Hi,

We have a meeting with CubeMX this week to talk about this specific issue

/Martin

VBurs
VBursAuthor
Associate III
March 16, 2021

Amazing news! Looking foward for a solution.