Skip to main content
Associate
November 9, 2025
Question

Integrate your own code with TouchGFX-created code

  • November 9, 2025
  • 5 replies
  • 337 views

Hi everyone

I am looking for a tutorial on: how to integrate your code in TouchGFX with some used case examples such as ON/OFF control of an LED or sending data over serial port to Putty terminal on PC

I am using the following Board:

STM32F469I-DISCO

5 replies

ST Employee
November 18, 2025

Hello,

Tutorial 7: Creating an Application for TSD knob display | TouchGFX Documentation uses both LEDs and UART communication. You can follow that guide and inspect the project to see how the hooks to use the hardware is set up.

You can also find some examples of how to do things like that as board specific demos in TouchGFX Designer, although none of them are for your particular board:

mathiasmarkussen_0-1763469837448.png

 

Arash_TahAuthor
Associate
November 19, 2025

Thanks mathias markussen 

I appreciate your help, I'll take a look

kind regards 

ST Employee
December 5, 2025

The board bringup documentation is a good place to start:

Board Bring Up Introduction | TouchGFX Documentation

In general, TouchGFX relies on a way to read assets and display them on a screen, and it is up to the user to supply the means to that. The source of assets would usually be flash. If the flash is Q/O/HSPI, it will usually be memory mapped, in which case it is just read directly. Alternatively there is an option to supply a data reader to read, for example, normal SPI flash or EMMC.

Drawing on the screen is usually done in a framebuffer or two. If the LTDC is used to send data to a parallel RGB or DSI screen, code is generated to handle the framebuffers automatically. For DSI video mode and parallel RGB, this is usually enough, but for DSI a little custom code may need to be added.

For screens with SPI, FMC or other interfaces, it is up to the user to tranfer the pixels. This will usually be done using DMA, so the system is free for other tasks, like rendering the upcoming frame. For low-bandwith displays with internal frame memory, it is also possible to use a partial framebuffer that just updates the parts of the screen that changes from frame to frame, and does not hold the entire framebuffer in memory.

I hope this clears up where to start, at least. Since we already supply a Board Setup for that board, you can take inspiration from there. I would advise not to spend too much time on your own on the DSI stuff, it's a pretty complicated protocol that is very hard to debug.

 

Lewis233
Associate III
December 5, 2025

Thanks! If I have already configured LTDC, DSI-Video, and TouchGFX in STM32CubeIDE, do I still need to write any code myself to make TouchGFX use the DSI interface?

ST Employee
December 5, 2025

Not to make TouchGFX use the interface, it will send the framebuffer using LTDC, but the display needs to be initialized by sending a bunch of commands. 

Lead II
December 5, 2025

You interface your TouchGFX GUI with your application using the model in the model tick.
In the tick your model can send data to and receive data from screens and send data to and get data from your application.
Model is in C++. If your application is in C you need to declare shared functions and shared global variables as extern "C".

"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."
ST Employee
December 16, 2025

TouchGFX does not render the screen unless anything actually changes from frame to frame.

You can force a rerender on every frame by adding an interaction that runs every tick calling invalidate():

mathiasmarkussen_0-1765874714461.png

 

ST Employee
December 18, 2025

The settings look fine to me, but it's generally very difficult to debug DSI issues.

In your last image of the screen, it looks like the pixels are shifted. Can you tell if there is a black pixel missing on one side of the box on the lines where there is an extra pixel at the other side of the bus?

It looks timing related to me, but again, it's hard to guess whats going on in a DSI interface.

Lewis233
Associate III
December 19, 2025

Does this imply that LTDC configuration must be aligned with screen specifications, whereas DSI configuration necessitates individual fine-tuning?

ST Employee
December 19, 2025

Not necessarily, but it complicates things, and it's not easy to troubleshoot because of the large amount of parameters.

If I remember correctly, some of the values in the DSI host pane is auto-calculated based on your LTDC settings, but not always re-calculated when changing the DSI settings.

I definitely think your active width should be the same between both panes. Disabling DSI and re-enabling it should trigger the calculation.