cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX with SPI TFT

ebray
Associate II

I've created a simple project to interface a STM32L4R91-DISCO with a TFT using a SPI interface. I've attempted to follow the TouchGFX tutorial but thus far have been unsuccessful in getting the TouchGFX library to render anything.

I have a task that sits in a loop, periodically calling OSWrappers::signalVSync(). This appears to work as the vsync_queue fills up. However, in my separate task which is running the ToughGFX loop, the call to OSWrappers::waitForVsync never returns. This mean the frames don't get rendered and flushed to the display.

Any suggestions for getting this running would be greatly appreciated!

I'm using STM32CubeIDE 1.3.1 with TouchGFX 4.13.0.

31 REPLIES 31
Martin KJELDSEN
Chief III

How did you create the project? Are you entering the TouchGFX main event loop ( HAL::taskEntry() )? If not then nothing will take elements off the vsync queue (And, as far as our OSWrappers are concerned, the queue is of length 1).

/Martin

Martin KJELDSEN
Chief III

Are you hitting a breakpoint in OSWrappers::waitForVsync() - You say it never returns but it's not clear to me if you mean that the code is actually being executed.

/Martin

ebray
Associate II

Martin,

I created the project in CubeIDE and used the TouchGFX Generator. My project is in C so I created "gfxwrappers.h/cpp" to translate the necessary functions. Here are my two tasks:

void start_main_task(void *argument)
{
#include "gfxwrappers.h"
 
  for(;;)
  {
      vTaskDelay(pdMS_TO_TICKS(100));
      oswrappers_signalVSync();
  }
}
 
void start_gui_task(void *argument)
{
  /* Infinite loop */
    MX_TouchGFX_Process();
}

Inside OSWrappers::waitForVsync() there are two calls to osMessageQueueGet(). The first one, intended to clear the queue, returns as expected but the second call blocks forever. I've used breakpoints to confirm this. I also have a breakpoint inside TouchGFXGeneratedHAL::flushFrameBuffer and it is never reached.

The gui_task seems to be stuck at touchgfx::HAL::lockFrameBuffer(). Unfortunately, the debugger says there is "no source available" for any of the calls after touchgfx::HAL::backPorchExited() so I don't have much visibility into what's happening beyond that.

Martin KJELDSEN
Chief III

Please show me your OSWrappers

ebray
Associate II

I've attached the OSWrappers.cpp that was generated by the tools . My gfxwrappers files are also attached which just provides a simple extern helper to allow me to call signalVSync() from C.

ebray
Associate II
 
ebray
Associate II
 
Martin KJELDSEN
Chief III

Hi @ebray​,

Please remove the call to acquire in initialize and get back to me.

/Martin

Martin KJELDSEN
Chief III

Also, i'd suggest driving TouchGFX not from another thread controlled by a scheduler, but from an actual signal from display, controller or hardware timer.

/Martin