Skip to main content
Senior III
May 11, 2026 7:42 AM UTC
Solved

How to limit TouchGFX to 30 fps

I'm using an STM32H7S78-DK with TouchGFX and FreeRTOS. I would like to limit the framerate of the target to 30fps but withouth reducing the LTDC frequency.

Basically having the VSYNC fired at 30fps

I've already set the 

 ((touchgfx::HALSDL2*)&hal)->setVsyncInterval(33.333);

In the simulator

Is there a way to force it on the target?

unsigned_char_array
Lead III
May 11, 2026 8:23 AM UTC

You can increase the front and back porches in your LTDC. 
This way you use more LTDC clock cycles per frame so your frame rate drops.

unsigned_char_array_0-1778487810723.png

unsigned_char_array_1-1778487931547.png

 

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."

5 replies

unsigned_char_array
Lead III
May 11, 2026 8:05 AM UTC

Increase your porch sizes.

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."
nico23Author
Senior III
May 11, 2026 8:15 AM UTC

what? Would you be more precise

unsigned_char_array
Lead III
May 11, 2026 8:23 AM UTC

You can increase the front and back porches in your LTDC. 
This way you use more LTDC clock cycles per frame so your frame rate drops.

unsigned_char_array_0-1778487810723.png

unsigned_char_array_1-1778487931547.png

 

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."
nico23Author
Senior III
May 11, 2026 10:59 AM UTC

Hi @unsigned_char_array 

Thanks a lot for the answer. My goal in reducing the refresh rate was to save CPU cycles for other operations; with the approach you propose, it feels like I'm just burning CPU cycles to drop the FPS, without really removing work to process the frame, or am I wrong?

Studying a bit, I've found out that another way is to use a custom timer set to 30Hz and toggle the VSYNC pin, but I think that's way more tricky than changing parameters in CubeMX

unsigned_char_array
Lead III
May 12, 2026 8:14 AM UTC

@nico23 wrote:

Hi @unsigned_char_array 

Thanks a lot for the answer. My goal in reducing the refresh rate was to save CPU cycles for other operations; with the approach you propose, it feels like I'm just burning CPU cycles to drop the FPS, without really removing work to process the frame, or am I wrong?


 The CPU is not busy waiting (blocking) for LTDC interrupts. You'll actually get more idle time per frame.

unsigned_char_array_0-1778573687454.png

 

https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-measure-performance#performance-metrics

 

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."