Tick Rate Slows to 1 Tick per 2.5 Seconds
I am working with a project in TouchGFX Designer/Generator 4.17 and STM32CubeIDE 1.7.0, which uses the LTDC interrupt from the display to drive the main display loop. The display is configured according to the manufacturer's specifications, and TouchGFX generator generates code to enable the VSYNC interrupt, which calls OSWrappers::signalVSync() to unblock the main loop. Adding a counter to signalVSync() and examining its value after an elapsed time indicates that the VSYNC interrupt, HAL_LTDC_IRQHandler(), is occurring at a rate of approximately 170 times per second and that signalVSync() is being called at half that rate, or 85 times per second:
unsigned int signalCount = 0;
void OSWrappers::signalVSync()
{
signalCount++;
osMessageQueuePut(vsync_queue, &dummy, 0, 0);
}
When rendering is done, a corresponding TouchGFX-generated call is made to OSWrappers::waitForVSync() to indicate that rendering is complete. A similar analysis shows that waitForVSync() is also being called at a rate of 85 per second:
unsigned int waitCount = 0;
void OSWrappers::waitForVSync()
{
waitCount++;
uint32_t dummyGet;
// First make sure the queue is empty, by trying to remove an element with 0 timeout.
osMessageQueueGet(vsync_queue, &dummyGet, 0, 0);
// Then, wait for next VSYNC to occur.
osMessageQueueGet(vsync_queue, &dummyGet, 0, osWaitForever);
}
All this translates to a received tick rate in the TouchGFX application of 85 ticks per second.
However, at some point, sometimes sooner, sometimes only after an extended period of time, interaction with the display becomes impossible---buttons do not respond, screen transitions do not happen, etc. Setting a breakpoint in the tick handler verifies that the tick is actually still occurring, but at a rate of app. 1 tick every 2.5 seconds. This situation has been seen to occur with a wide range of task mixes, including when the GUI task is the only one running (all others removed), and with a variety of screen mixes. In fact, the slowdown has been seen to occur most reliably on a project with single screen with a large flex button in the middle.
Once the slowdown occurs, it is seen that signalVSync() is still being invoked at 85Hz, while waitForVSync(), like the tick, is only being invoked at 0.4Hz.
My sense is that this issue may be a result of the faster clock rate of 85Hz, which is approximately 42% higher than the normal 60Hz rate. So, as this is basically a show-stopper issue, I welcome comments or suggestions as to how to address the problem.