cancel
Showing results for 
Search instead for 
Did you mean: 

Would like to use a 240 x 240 LCD with SPI that has a 12 pin interface, but does not include a pin for the TE, (Tearing Effect) output from the Display to synchronize the frame rate with the MCU. How can I know when to write to the display without TE?

JRuss.5
Associate II
 
1 REPLY 1
Richard Lowe
Senior III

I'm new to TouchGFX, but I believe I have a decent answer:

You will need to call the signalVSync occasionally. This works as a driving mechanism for the engine. It pushes a message onto the queue that the engine is waiting for.

That function is found in the OSWrappers:: class. Add this to the TouchGFXHAL.cpp file:

extern "C"
void TE_Handler(void)
{
	/* VSync has occurred, increment TouchGFX engine vsync counter */
	touchgfx::HAL::getInstance()->vSync();
	/* VSync has occurred, signal TouchGFX engine */
	touchgfx::OSWrappers::signalVSync();
}

The TE_Handler will need to be called after an amount of time that represents an amount of time that would take to write the entire screen + some buffer time.

extern void TE_Handler(void);

extern void TE_Handler(void);
 
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */
 
  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM6) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */
  else if( htim->Instance == TIM5 )
  {
	  TE_Handler();
  }
  /* USER CODE END Callback 1 */
}

Too fast and the screen won't be written completely and you will get artifacts.