cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with TouchGFX on STM32H747-DISCO: freezing while an other task runing with higher priority.

LBESO.1
Associate III

Hi ! I'm currently working on a STM32H747-DISCO with TouchGFX to test and discover this graphic library. 

My touchGFX app is only 2 screens with a button to go screen 1 or 2 with a slide animation.

But when I'm implementing an other task in FreeRTOS with a higher priority, TouchGFX freeze at some point when i'm changing screen. My goal was to see when the animations of the library would lag with an other task running on the M7.

Do you have any idea why the screen freeze ? It may be linked to the slide animation of screen.

1 ACCEPTED SOLUTION

Accepted Solutions
LBESO.1
Associate III

Hi,

I just worked again on this issue, so here is an update and a summary about my problem.

-> The problem :

I'm working on a STM32H747-DISCO with the graphic library TouchGFX. I'm only using the M7 core under FreeRTOS. I added an other task called "CPU_Burner" to stress the CPU with some calculation to see how the TouchGFX's task respond and if the lagging effect is acceptable at some degrees. Of course the CPU_Burner task got an higher priority than the TouchGFX one or it won't get impacted.

When I flash the card and set up my CPU burner at 30% of the total load for example, after swiching between the two screens 1, 2 or 3 times, the TouchGFX GUI task freezed. And it's impossible to get it run again. The other task got no problem and is still runing, only TouchGFX and the screen remains fixed.

-> What I have done so far :

  • I debugged the program to see where TouchGFX is stucked and it seems that it's in the file "OSWrappers.cpp", in the function "void OSWrappers::signalVSync()". If I understood correctly, the message queue to tell TouchGFX that the VSYNC buffer is ready to render is full.
  • I added SystemView to monitor the application and i got the same result, TouchGFX stucked in signalVsync.
  • I tried different screens setup and others projects and it allways endup freezing.
  • For the MCU hint I disabled it and it didn't fixed anything. I will set up the precise address range for each external memory next week.

Some people managed to solve a similar issue with the MCU reconfiguration, in

this ST forum :

https://community.st.com/s/question/0D53W00000e067WSAQ/ui-stuck-in-takeframebuffersemaphore

-> The only solution that I Found :

  • On that ST forum someone had a problem close to mine and apparently related to the DMA/DMA2D. He found a solution for his problem, adding some code in TouchGFXHAL.cpp to this function :

void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef* hdsi)

" if (!refreshRequested)

          HAL::getInstance()->allowDMATransfers(); "

  • I did the same and now everything seems fine but I didn't really understood why. The problem seems related to a framebuffer lock but I can't manage to access it and monitor the lock and unlock.

I made a simplier project with System View with with the same issue. You can download it and try my project to see the freeze by yourself.

Thanks again to all the people trying to solve this ! 🙂

View solution in original post

25 REPLIES 25
Yoann KLEIN
ST Employee

Hello @LBESO.1​ ,

Can you please provide more information ?

  • Which version of TouchGFX are you using ?
  • Can you maybe share screenshots and attach your project so it could be easier to help you ?

Thanks,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
LBESO.1
Associate III

Hey, thanks for that quick answer, I'm using TouchGFX V4.19.1.

I'm currently cleaning my project to get it easier to share. Will post everything as soon as i can.

LBESO.1
Associate III

Here is the amin files of my small project.

I use Get Run Time Stats from FreeRTOS to monitor the CPU's load with 2 tasks :

  • 1 for TouchGFX Normal priority
  • 1 to stress the CPU (some for loop and a delay after) in priority Normal+1

There is also a folder for SEGGER RTT because i'm using RTT printf when debugging with a JLINK probe.

My TouchGFX application is composed of 2 screens, nothing crazy :

  • First with a go to screen 2 button with slide animation and a icon going on/off when i press the joystick of the H747 board (led orange turn on/off)
  • Second with a go to screen 1 button with a slide animation, a button to turn on/off the blue led and changed a bulb picture on/off on the screen.

When I'm trying to get the application lagging it freeze the majority of the time and i get stuck with a screen like this one (here in during a slide) : 0693W00000NsovqQAB.jpg 

Hello,

Can you please share your whole project ? (TouchGFX project, .ioc file, and all the generated files).

I will try to reproduce your problem and debug your project.

Thank you,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

Hi,

Here it is.

As far as i am researching the problem, i found out 2 things :

  • When my CPU burning task is runing for 50ms (50%) for example, and free 50ms (50%) for the other tasks, touchGFX allways take around 6-7% and the rest is stuck in the Idle Task. Isn't TouchGFX supposed to use eveything it can get ?
  • When TouchGFX task is freezed, it is stucked in OSWrappers::signalVSync(), osErrorResource returning -3 = ressource not available.

Thanks you.

Hi,

Don't hesitate to tell me if things aren't clear in my (a little messy) project.

Again thanks for your time and help.

Hello,

I tried to reproduce your error, without success.

For me, even when I had a second task, everything is still working fine and nothing freezes or crashes.

Did you already try to start a new project from scratch (using the TouchGFX Board Setup) and then add sequentially your elements from the other project to identify from which part does your issue come from ?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
LBESO.1
Associate III

Good morning,

Thanks for your attempt. I already tried on an other old project with several screens but same issue.

  • If I add a second task (stressing the CPU) with the same priority as the touchgfx task, everything works fine. Here putting it higher in priority regarding FreeRTOS make touchgfx task freeze at some point.

  • While freezing the touchGFX task is blocked calling osMessageQueuePut(vsync_queue,&dummy,0,0) in the OSWrappers. Returning -3.

In the project i sent you, there is a variable called cpu_burner_variable1 initialize at 10 (ms). And the osdelay at the end of the second task fixed to 100(ms). Could you just try with cpu_burner_variable1 over 60 for example and osDelay at 100 - cpu_burner_variable1?

It should highly increase the chance to get a Freeze.

I will try again from scratch adding second task with nothing in TouchGFX GUI’s screen and see if it Freezed.

Thanks you again for your help.

Good morning,

Thanks for your attempt. I already tried on an other old project with several screens but same issue.

  • If I add a second task (stressing the CPU) with the same priority as the touchgfx task, everything works fine. Here putting it higher in priority regarding FreeRTOS make touchgfx task freeze at some point.

  • While freezing the touchGFX task is blocked calling osMessageQueuePut(vsync_queue,&dummy,0,0) in the OSWrappers. Returning -3.

In the project i sent you, there is a variable called cpu_burner_variable1 initialize at 10 (ms). And the osdelay at the end of the second task fixed to 100(ms). Could you just try with cpu_burner_variable1 over 60 for example and osDelay at 100 - cpu_burner_variable1?

It should highly increase the chance to get a Freeze.

I will try again from scratch adding second task with nothing in TouchGFX GUI’s screen and see if it Freezed.

Thanks you again for your help.