cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX Rendering Time and real-time constraints.

AndrewST
Associate II

In an OS free environment, with software running on an H7, one would call MX_TouchGFX_Process() indefinitely in the main so that TouchGFX will do its thing, render the graphics and pop them on the display, all synchronized by the VSYNC interrupt generated by the LTDC. If I understand correctly, that means in a typical 60fps display, MX_TouchGFX_Process() will return immediately most of the time except every 16.66ms where we need the next frame to be rendered. Render time is about 5ms when the frame does not need any update and 25 ms when text and such need to be updated.

How does one integrates this in a real-time environment where several tasks need to be run every 1ms, based of a simple timer? My understanding is that every 16.66ms, MX_TouchGFX_Process will be running for up to 25ms and nothing else will be happening during that time, which is not acceptable.

If I run my code and put a scope on a digital output that measures how long MX_TouchGFX_Process takes (ie the render time) and also pulse another output in a 1ms timer, I do not see either tasks being interrupted. How is that even possible? What happens when the timer interrupt fires but MX_TouchGFX_Process is in the process of rendering a frame? Is MX_TouchGFX_Process interrupted and the frame lost (i don't see the render time shorten)? Is it interrupted and resumed (I don't see any mechanism for that)?

What would be the best practice -aside from using a dual core STM32- to have a steady real-time 1ms loop while running the TouchGFX graphic engine. Is that even possible if TouchGFX does not have a suspend-resume process available?

Thank you

4 REPLIES 4
MM..1
Chief II

Operating Systems | TouchGFX Documentation

Not using an RTOS does not lower the performance of TouchGFX. It may increase the MCU load and it will make it more difficult to run other tasks together with TouchGFX.

For 1ms or other tasks you can use timer interrupts, but better normal way is event based interrupts...

And you miss in 16.66 usw. TouchGFX process render to memory and if on screen is no change next calls took 0ms... plus time in model tick code. This is true for hw based offload drivers as LTDC .

AndrewST
Associate II

Thank you but that does not answer the question which is: what happens when the timer interrupt fires while TouchGFX is in the middle of rendering a frame that takes 25ms? And how do you deal with that.

MM..1
Chief II

Rendering is normal code = any interrupt is possible and continue.

So you are saying rendering gets suspended, the interrupt handler is executed and then rendering resumes right back where it was?