Skip to main content
Version: 4.16

LTDC/Parallel RGB

For MCUs with a TFT controller (e.g. STM32F429, STM32F746, STM32H7), the TouchGFX Generator can generate the part of the HAL that configures the LTDC to transfer pixels from the framebuffer memory to the display. The generated code both starts the correct framebuffer transfer and unblocks the TouchGFX Engine main loop by calling OSWrappers::signalVSync() once a VSYNC interrupt is raised by the LTDC.

Display Interface#

As opposed to a "Custom" display interface, where the developer must implement the whole driver by hand, for LTDC the TouchGFX Generator can generate all the code necessary for the TouchGFX HAL to support an LTDC configuration.

For "Parallel RGB (LTDC)" to be a selectable option through the TouchGFX Generator the LTDC must be enabled from the Multimedia group in the CubeMX category list.

Once LTDC is enabled, the Parallel RGB (LTDC) option becomes available through the Display section of the TouchGFX Generator.

Even after LTDC is enabled through CubeMX, some work is required in order to:

  1. Configure LTDC (GPIO and timings) to match connected display specifications
  2. Configure LTDC to match desired TouchGFX application specifications.

The TouchGFX Generator can read various configurations from CubeMX and provide a list of warnings, recommendations or errors that are called Dependencies. The image below shows the list of dependencies present when initially enabling LTDC in CubeMX for any MCU (in this example we used an F429):

LTDC recommendations, warnings and errors will be visible in the TouchGFX Generator interface as soon as LTDC is enabled through CubeMX.
Unsupported pixel formatThe framebuffer drivers of TouchGFX are only available in RGB565 (16-bit) and RGB888 (24-bit). The pixel format of the LTDC must match the chosen driver for the TouchGFX HAL.
Additional layers configuredTouchGFX is only capable of utilizing a single layer. While TouchGFX applications can work with two layers enabled, this is a warning to the user that the LTDC is potentially misconfigured. Change the number of layers in the LTDC block.
Blending factors should be PAxCABy default, the blending factor is Alpha Constant.

This should be Alpha Constant x Pixel Alpha
Alpha Constant is 0By default, the alpha constant of LTDC layers is 0. This should be > 0 and preferably 255 unless there is an intent to have a global alpha at all times in an application.

Remember to actually select the Parallel RGB (LTDC) display interface after enabling the LTDC peripheral in the Multimedia section.

The following image shows the LTDC configuration that satisfies the conditions of the warnings, causing the Dependencies group to disappear from the TouchGFX Generator interface.

Reading settings from CubeMX#

By selecting Parallel RGB (LTDC) as the display interface through TouchGFX Generator, the width and height of the framebuffer is inherited from the LTDC configuration horizontal start/stop and vertical start/stop.

Defining the dimensions of Layer 0 according to the display and application dimensions a new entry in the Dependency window appears.

Ensuring that Framebuffer Image Width and Image Height match the size of the window, which is usually desired, will satisfy the warning.

TouchGFX Generator inherits the Width and Height values from the LTDC configuration, if LTDC is enabled. However, Width and Height can still be modified from the TouchGFX Generator interface. Changing these values can lead to a configuration mismatch if they do mot respect the Window LTDC Layer configuration.

TouchGFX Driver / VSYNC Signal#

Once Parallel RGB (LTDC) is selected as Display Interface, developers gain access to the LTDC Application Tick Driver or TouchGFX Driver.

The following code is the interrupt handler (STM32F7) for the LTDC interrupt generated according to LTDC configuration. The generated handler automatically unblocks the TouchGFX Engine main loop.

extern "C"
irq void LTDC_IRQHandler(void)
if (LTDC->ISR & 1)
LTDC->ICR = 1;
if (LTDC->LIPCR == (LTDC->AWCR & 0x7FF) - 1)
//entering active area
For the LTDC driver to work, users must enable the LTDC global interrupt through the LTDC NVIC settings or through Global NVIC settings, and also enable generation of handler code.


Enabling the Parallel RGB (LTDC) display interface option through TouchGFX Generator allows all required HAL code to be generated.

  • Sets the width, height and pixel format of the TouchGFX application in accordance with the CubeMX LTDC configuration. The LTDC layer width and height impact the size of the canvas in TouchGFX Designer and the LTDC Pixel Format impacts the required TouchGFX framebuffer driver and also the format for generated assets.
  • Allow the LTDC application tick source to be selected which generates a handler to drive the TouchGFX Engine Main loop. Usually, with LTDC Configurations developers would always use the provided Application Tick Driver.