2025-04-30 6:42 AM
Hi everyone,
I'm using TouchGFX on a STM32U5G9 microcontroller and got stuck while trying to enable GPU2D (aka NeoChrom).
The starting and working configuration is TouchGFX + LTDC + DMA2D. Everything works properly: the signalVSync function of the OSWrappers is called periodically due to LTDC interrupts and so the counterpart waitForVSync.
As soon as I enable the GPU2D acceleration from CubeMX (following the guide here https://support.touchgfx.com/docs/development/touchgfx-hal-development/generator-how-to/touchgfx-al-configuration/driver), the screen remains black despite the signalVSync function is actually called. On the other hand the waitForVSync function is called 2 or 3 times and then no more.
Does anyone have an idea of what's happening? What am I doing wrong?
Thank you for your help.
2025-05-05 12:45 AM
Hello,
Do you get correct screen output with only DMA2D enabled?
What screen size and framebuffer strategy are you using? Are your framebuffers located in internal or external RAM?
2025-05-05 12:58 AM
Hi, yes, I get correct screen output only with LTDC + DMA2D. As soon as I enable GPU2D (in addition to LTDC and DMA2D), the screen goes black.
Screen size is 720 * 720 pixels and frame buffer strategy is "double buffer by allocation". The MCU I'm using is STM32U5G9 and has 3 MiB of RAM, so 2 MiB are dedicated to graphics.
The following is the working configuration for your convenience. To enable NeoChrom, I set the "Use GPU2D Accelerator" option from "No" to "Yes".
2025-05-05 1:17 AM
Do you have external RAM, and if you do, have you specifically linked the framebuffers to internal ram?
You can check for LTDC underrun errors by breaking in the LTDC error interrupt handler.
The TouchGFX designer comes with a number of board setups out of the box. For STM32U5G9j-DK2 a ThreadX variant is included. You can try to look at the CubeMX project and linker scripts from that project and see if there are any major differences to your project.
2025-05-05 1:33 AM
I don't have any external RAM. As per my first message, the "signalVSync" function is always called and the LTDC ISR works properly. On the other hand, the "waitForVSync" function is called 2-3 times and then no more. Thus, the internal TouchGFX machine stops to evolve. LTDC, DMA2D and GPU2D interrupts are enabled under "NVIC" section of CUBEMX. There are no special customization in the linker script.
Thank you for your help.
2025-05-05 2:01 AM
Make sure the GPU2D error interrupt is enabled as well, this is, somewhat counterintuitively, required for some operations.
2025-05-05 6:36 AM
I tried with no success. The following is my NVIC configuration
I also tried to enlarge the TouchGFX task's stack area, but nothing changed.
Do you have any other suggestion by any chance?
2025-05-06 6:18 AM
What IDE are you using? What does the call stack look like when it stops?
What are you stack and heap sizes set to in CubeMX under project settings? I'd recommend setting both to at least 0x1000 if they are not.
In our documentation (including the link you shared) we generally recommend smaller memory pool sizes for the TouchGFX pool and stack in ThreadX than you have set, so maybe go through all the ThreadX settings again, to make sure they are lined up. Setting the it too high should not be a problem, I believe, as long as you have set the pool size in ThreadX to be able to contain it, but the it would not give a benefit either.
I would also advise you to copy the code that places framebuffers as well as some GPU2D memories the TouchGFX project. They cannot really go anywhere but RAM, but they are uninitialized, which will at least save you some flash space.
You could also try to just take that project and modify it to fit your hardware, you should get pretty far by disabling the external flash and maybe changing some IO assignments for your peripherals.