TouchGFX and RTOS Initialization Issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-12 4:09 PM
Hello.
I've been trying to implement FreeRTOS and TouchGFX into my STM32G071RB + GFX01M2 application (eventually I'd like to use G0B1RE for extra RAM). I've followed the link: https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-configure-rtos
but am experiencing issues trying to get my code to work. The main issue I'm dealing with is the code fails to initialize execute MX_TouchGFX_Init(). After some digging around, I noticed that the code hangs in HAL_delay(100), line 284 of MB1642DisplayDriver.c. Further digging, I found that the external interrupt of the DISPLAY_TEARING_EFFECT_Pin is triggered, which results in the calling of some RTOS functions before the kernel has even started. I noticed that this only happens after Display_DCS_Send_With_Data(DCS_SET_TEAR_ON, arguments, 1) is called. I can make OSWrappers functions check if the kernel has been started, but this causes other problems and I am not sure if this is the correct approach.
Any approach would be greatly appreciated!
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
-
TouchGFX
-
TouchGFX Designer
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-25 3:27 PM
Update: The reason behind the flickering was because I had one of the outputs of my rotary encoder hooked up to the SPIB pin of the GFX01M2 board which was causing issues with the data stream resulting in the screen flicker and other weird behaviors. On the GFX01M2 pins 35 and 36 are shorted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-16 9:57 AM
Update:
I've done lots of digging around on this issue. I've noticed that the culprit of this issue is the fact that the vector table interrupt has not been defined in system_stmg0xx.c. Defining it fixed the problem, only to run into a hardfault error.
I've stepped through the code to see what is going on. I've managed to trace the issue to HAL::initialize() function in the TouchGFXGeneratedHAL::initialize() function. The issue is that HAL::initialize() disables the Systick interrupt even though the VTOR address has been defined. I've verified that HAL_Delay() works prior to HAL::initialize(), but stops working after the function call.
I've also tried using a different approach to work around the problems I've been dealing with. I noticed the H503RB + GFX01M2 example in TouchGFX uses the same screen and RTOS. However, the driver files are different. The G071RB example uses the MB1642 driver while the H503RB uses the GFX01M2 driver. I've integrated the GFX01M2 driver files from the H503RB example into my project. The project compiled successfully and even managed to start the RTOS kernel. However, I ran into an infinite loop in the allocateBlock function within the FrameBufferAllocate.hpp file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-23 3:50 AM
Hello @TS-LMG ,
MB1642 and GFX01Mx are basically the same thing :
This table also shows the correct driver to use.
For the GFX01M2, you should use the MB1642D.
https://www.st.com/resource/en/user_manual/um2750-spi-display-expansion-boards-for-stm32-nucleo64-stmicroelectronics.pdf
I am not sure why you have an infinite loop but ensuring that you have the correct driver seems to be the first step since it is the driver change that enabled that infinite loop.
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-24 9:59 AM
Hello @GaetanGodart,
A little update. I still could not get RTOS to work with the G0B1, so I just went ahead and purchased the H503 Nucleo. Coding for the G0B1 without RTOS works fine, and I managed to get a GUI template for my application. I ported over my G0B1 GUI to the H503 with RTOS. It compiles fine, however, I'm now dealing with a screen flicker every time I switch screens. This does not happen for my non-RTOS G0B1 application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-25 3:27 PM
Update: The reason behind the flickering was because I had one of the outputs of my rotary encoder hooked up to the SPIB pin of the GFX01M2 board which was causing issues with the data stream resulting in the screen flicker and other weird behaviors. On the GFX01M2 pins 35 and 36 are shorted.
