Skip to main content
Sergii Volchenko
Associate III
January 20, 2021
Question

STM32IDE+TouchGFX can't start.

  • January 20, 2021
  • 9 replies
  • 3876 views

I try to connect LCD by SPI to Nucleo-767 and TouchGFX.

LCD screen work perfect and I could draw on it without a problem, but I stuck with TouchGFX.

I found that void TouchGFXHAL::flushFrameBuffer never call.

Check this video - https://youtu.be/1UhEx7E_dH0

What I did:

  1. New project for my board
  2. Make timer for VSync each 15ms
  3. Add TouchGFX Generator package
  4. Add CRC
  5. In TouchGFX settings set size 320x240 and RGB888.
  6. Open TouchGFX Designer, add button, and generate code.
  7. In code add start & callback for timer and call function for generate tick
  8. add switch on led on board.

LED doesn't light.

Of course, I checked that timer callback works, led works.

In debug mode I found that app stuck in lockFrameBuffer function.

What I did wrong?

This topic has been closed for replies.

9 replies

MM..1
Chief III
January 20, 2021

Seems as you plan use TouchGFX without OS then read and apply all steps for this config from docu.

Too write how mode display you use?...

Sergii Volchenko
Associate III
January 20, 2021

What steps i missed? Vsync -> flushbuffer.

I tried with rtos but steps the same - generate vsync, in flushbuffer send from buffer to screen.​

Sergii Volchenko
Associate III
January 20, 2021

Yes, i implemented all of that. ​What next?

​Again, the problem that flushBuffer doesnt call, so no sense show full code of it.

MM..1
Chief III
January 20, 2021

Try show your code here for example

void OSWrappers::signalVSync()
{
 
}

...

Sergii Volchenko
Associate III
January 20, 2021

I think this is autogenerated function

void OSWrappers::signalVSync()
{
 vsync_sem = 1;
}

MM..1
Chief III
January 20, 2021

and where you call it ?...

i write for example best is place here all relevant code

Sergii Volchenko
Associate III
January 21, 2021

main.c

extern void touchgfx_signalVSyncTimer(void);
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
 if (htim->Instance == TIM13) {
 touchgfx_signalVSyncTimer();
 }
}

TouchGFXHAL.cpp

extern "C" void touchgfx_signalVSyncTimer(void)
{
 HAL::getInstance()->vSync();
 OSWrappers::signalVSync();
}

timer setup

static void MX_TIM13_Init(void)
{
 
 /* USER CODE BEGIN TIM13_Init 0 */
 
 /* USER CODE END TIM13_Init 0 */
 
 /* USER CODE BEGIN TIM13_Init 1 */
 
 /* USER CODE END TIM13_Init 1 */
 htim13.Instance = TIM13;
 htim13.Init.Prescaler = 47999;
 htim13.Init.CounterMode = TIM_COUNTERMODE_UP;
 htim13.Init.Period = 30;
 htim13.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
 htim13.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
 if (HAL_TIM_Base_Init(&htim13) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN TIM13_Init 2 */
 HAL_TIM_Base_Start_IT(&htim13);
 /* USER CODE END TIM13_Init 2 */
 
}

 Stacktrace on pause

0693W000007C6MZQA0.png 

MM..1
Chief III
January 21, 2021

Place breakpoint in

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
 if (htim->Instance == TIM13) {
 touchgfx_signalVSyncTimer();
 }
}

check period of call and start with longer periods. You need time to render full one frame.

When your display provide TE use it instead timer...

Sergii Volchenko
Associate III
January 21, 2021

I set the timer to 4 seconds period - the result absolutely the same.....

Sergii Volchenko
Associate III
January 21, 2021

also can't understand next in documentation: HAL vs TouchGFXHal0693W000007CDdwQAG.png

MM..1
Chief III
January 21, 2021

You dont show any part of display code , then i cant help. Try inspire run TouchGFX and create project for G071 , that is noos display.

For example primary func here

void TouchGFXHAL::initialize()
{
 // Calling parent implementation of initialize().
 //
 // To overwrite the generated implementation, omit call to parent function
 // and implemented needed functionality here.
 // Please note, HAL::initialize() must be called to initialize the framework.
 
 /* Initializing Display and SerialFlash drivers */
 MB1642BDisplayDriver_Init();
 DataReader_Init();
 
 /* Prepares Display for operation */
 MB1642BDisplayDriver_DisplayReset();
 MB1642BDisplayDriver_DisplayInit();
 
 /* Initialize TouchGFX Engine */
 TouchGFXGeneratedHAL::initialize();
 setButtonController(&bc);
 
 /* Wait for first VSync from display */
 touchgfx::OSWrappers::waitForVSync();
 
 /* Render first frame, so there is valid date in the displays GRAM */
 HAL::getInstance()->backPorchExited();
 
 /* GRAM has been filled, turn on display to show content of GRAM */
 MB1642BDisplayDriver_DisplayOn();
 touchgfx::OSWrappers::signalRenderingDone();
}
 

Simply when you in Cube select CUSTOM drivers for touch , then you need write this drivers.

Sergii Volchenko
Associate III
January 21, 2021

Really i dont understand what ​link between screen initialization or sending data to it and calling flushbuffer....​

MM..1
Chief III
January 21, 2021

Link is simple when init is bad , code dont arive to flushbuffer for example TouchGFX 4.16.0 D-Cache flush causes HardFault... (st.com)

Sergii Volchenko
Associate III
January 22, 2021

If you checked my original message or video you see that I didn't not init LCD at all. So in code no work with LCD (init, send data or TE receive). Also I show dabug pause stacktrace. It stops not in hardfault but on lock framebuffer

MM..1
Chief III
January 22, 2021

Try use this as your init

void TouchGFXHAL::initialize()
{
 // Calling parent implementation of initialize().
 //
 // To overwrite the generated implementation, omit call to parent function
 // and implemented needed functionality here.
 // Please note, HAL::initialize() must be called to initialize the framework.
 
 
 /* Initialize TouchGFX Engine */
 TouchGFXGeneratedHAL::initialize();
 
 /* Wait for first VSync from display */
 touchgfx::OSWrappers::waitForVSync();
 
 /* Render first frame, so there is valid date in the displays GRAM */
 HAL::getInstance()->backPorchExited();
 
 touchgfx::OSWrappers::signalRenderingDone();
}

and not pause your code, better is place breakpoint ...

Sergii Volchenko
Associate III
January 22, 2021

All works as expected....

::initialize called from main.c, after that go inside waitForVSync, timer at this moment generate tick, and app stuck on this

0693W000007C6MZQA0.png

MM..1
Chief III
January 23, 2021

Other ticket writes about bug hang lockframebuffer in singlebuffer and no DMA, then i recommend you enable D2DMA plus irq, select it as TouchGFX accelerator. Second tickets writes about DCACHE and 4.16 with cortex7 . Try read and apply config to cortex 7 part in cube MX.

And next maybe stop you set framebuffer to internal ram by allocation, this is too not simplky with MMU ...

AND as primary good choice for build is select on create project for nucleo init onboard YES and not NO ...

Sergii Volchenko
Associate III
January 23, 2021

dcache disabled, d2dma I tried without success (I read these tickets).

About nucleo init not sure that understand - could you explain please.