2026-02-06 1:08 AM
I am a software developer working for a company that plans to use TouchGFX for its display solutions.
We are currently integrating TouchGFX into an existing IAR-based project and want to use our own display and DMA drivers instead of the CubeMX-generated setup. While TouchGFX initializes and runs partially, we are facing a critical issue where several expected callbacks are never triggered.
The following methods are never called during runtime:
TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect)
OSWrappers::takeFrameBufferSemaphore()
OSWrappers::giveFrameBufferSemaphore()
Our TouchGFX thread performs all required initializations, passes our custom LCD driver to TouchGFXHAL, and then calls touchgfx_taskEntry().
VSync-related callbacks are working:
OSWrappers::signalVSync() is executed
backPorchExited() is executed
lockDMAToPorch is 0 (as expected)
Despite this, no framebuffer flushing or framebuffer semaphore handling occurs.
Our TouchGFXGeneratedHAL::initialize() implementation looks like this:
void TouchGFXGeneratedHAL::initialize()
{
HAL::initialize();
registerEventListener(*(Application::getInstance()));
setListener(gFrontendApp);
setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);
}Observed state when registerEventListener() is executed:
hal.listener = 0
useAuxiliaryLCD = 232 (unexpected value)
lastRenderMethod = HARDWARE
displayOrientationChangeRequested = 1
Because the listener was not set correctly at that point, we added a helper method to HAL:
void setListener(UIEventListener* p_poListener)
{
listener = p_poListener;
}After calling setListener(gFrontendApp), the listener pointer is valid.
The gFrontendApp pointer is obtained during touchgfx_init():
void touchgfx_init()
{
Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize());
TypedText::registerTexts(&texts);
Texts::setLanguage(0);
FontManager::setFontProvider(&fontProvider);
FrontendHeap& heap = FrontendHeap::getInstance();
(void)heap;
gFrontendApp =
static_cast<FrontendApplication*>(touchgfx::Application::getInstance());
hal.initialize();
}At this point:
FrontendApplication exists correctly in the heap
gFrontendApp has a valid address
the HAL listener is set correctly after setListener()
Even with a valid listener and working VSync handling:
flushFrameBuffer() is never called
framebuffer semaphore functions in OSWrappers are never called
This suggests that TouchGFX never reaches the rendering/flush stage, or that the HAL state/configuration prevents these code paths from being entered.
Under which exact conditions does TouchGFX call:
flushFrameBuffer()
takeFrameBufferSemaphore()
giveFrameBufferSemaphore()
Can an incorrect HAL internal state (e.g. useAuxiliaryLCD, render method, orientation change flags) prevent framebuffer flushing entirely?
Are there known pitfalls when integrating TouchGFX into an existing IAR project (not CubeMX-generated) that could lead to this behavior?
Any guidance or hints on where to look next would be highly appreciated, as we would like to align our integration with the intended TouchGFX architecture.
Thank you very much for your support.