cancel
Showing results for 
Search instead for 
Did you mean: 

32F746GDISCOVERY: TouchGFX generated code does not use BSP for LTDC

KMew
Senior III

Hello,

I am trying to prepare some code for my custom board that has an LCD-TFT display on it. To try and digest the code, I have been using 32F746GDISCOVERY board for reference, since it's the closest to my display (RK043FN66HS-CTG is what I'm using). The discovery board uses a display with a TFT controller and the same touch controller (GT911).

The part that's confusing me is that the sample code only calls for the MX_LTDC_Init, which calls HAL_LTDC_Init() and HAL_LTDC_ConfigLayer(). I've attached the snippet for reference.

static void MX_LTDC_Init(void)
{
 
  /* USER CODE BEGIN LTDC_Init 0 */
 
  /* USER CODE END LTDC_Init 0 */
 
  LTDC_LayerCfgTypeDef pLayerCfg = {0};
 
  /* USER CODE BEGIN LTDC_Init 1 */
 
  /* USER CODE END LTDC_Init 1 */
  hltdc.Instance = LTDC;
  hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
  hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
  hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
  hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
  hltdc.Init.HorizontalSync = 45;
  hltdc.Init.VerticalSync = 22;
  hltdc.Init.AccumulatedHBP = 47;
  hltdc.Init.AccumulatedVBP = 24;
  hltdc.Init.AccumulatedActiveW = 847;
  hltdc.Init.AccumulatedActiveH = 504;
  hltdc.Init.TotalWidth = 1057;
  hltdc.Init.TotalHeigh = 526;
  hltdc.Init.Backcolor.Blue = 0;
  hltdc.Init.Backcolor.Green = 0;
  hltdc.Init.Backcolor.Red = 0;
  if (HAL_LTDC_Init(&hltdc) != HAL_OK)
  {
    Error_Handler();
  }
  pLayerCfg.WindowX0 = 0;
  pLayerCfg.WindowX1 = 800;
  pLayerCfg.WindowY0 = 0;
  pLayerCfg.WindowY1 = 480;
  pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
  pLayerCfg.Alpha = 255;
  pLayerCfg.Alpha0 = 0;
  pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
  pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
  pLayerCfg.FBStartAdress = 0;
  pLayerCfg.ImageWidth = 800;
  pLayerCfg.ImageHeight = 480;
  pLayerCfg.Backcolor.Blue = 0;
  pLayerCfg.Backcolor.Green = 0;
  pLayerCfg.Backcolor.Red = 0;
  if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN LTDC_Init 2 */
 
  /* USER CODE END LTDC_Init 2 */
 
}

This works and the display works as intended. However, based on other forum posts, there should be some sort of TFT driver used to configure the display. For example, the discovery board's display uses OTA5180A TFT driver. However, in the initialization of the code, there is no reference to the driver and no code in the BSP is called at all (i.e. stm32746g_discovery_lcd.c's functions). Essentially, the two HAL initialization codes handle everything.

So am I misunderstanding this, or do TFT 'drivers' only require the correct clock frequency, & vsync/hsync/hbp/vbp from the datasheet to work?

0 REPLIES 0