cancel
Showing results for 
Search instead for 
Did you mean: 

How to get 5" TFT LCD working with STM32H7A3 using LTDC and CubeIDE

JNguyen
Senior

I have STM32H7A3ZIQ Nucleo board and 5" Startek LCD KD050FWFPA011. I'd like to use CubeIDE to create code to copy an image from H7A's flash memory to the LCD using LTDC. I did get STM32H7A3ZIQ Nucleo to work with a 2" LCD using 4-wire SPI interface. The problem I have with 5" LCD is the LTDC interface. Attached is IOC file, CubeIDE code, init code from Startek, scope captures, etc.... Please help.

I got black screen. Backlight is on. IDE reports the image (Mushroom480x800) is defined but not used. Scope captures show 0x00 on pin LTDC_R4. LTDC_CLK is 24MHz, correct as designed. What do I miss?

14 REPLIES 14
JNguyen
Senior

LTDC_IRQHandler(void) is never been called. I've been looking for reason why IRQ is not generated.

From scope captures, VSYNC and HSYNC are generated continuously. RGB data lines are 0x0.

Try edit generated part before you understand howto...

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_AH;
 hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
 hltdc.Init.HorizontalSync = 3;
 hltdc.Init.VerticalSync = 3;
 hltdc.Init.AccumulatedHBP = 33;
 hltdc.Init.AccumulatedVBP = 33;
 hltdc.Init.AccumulatedActiveW = 513;
 hltdc.Init.AccumulatedActiveH = 833;
 hltdc.Init.TotalWidth = 531;
 hltdc.Init.TotalHeigh = 853;
 hltdc.Init.Backcolor.Blue = 0;
 hltdc.Init.Backcolor.Green = 127;
 hltdc.Init.Backcolor.Red = 0;
 if (HAL_LTDC_Init(&hltdc) != HAL_OK)
 {
   Error_Handler();
 }
 pLayerCfg.WindowX0 = 0;
 pLayerCfg.WindowX1 = 480;
 pLayerCfg.WindowY0 = 0;
 pLayerCfg.WindowY1 = 800;
 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.FBStartAdress = (uint32_t)Mushroom380x600;
 pLayerCfg.ImageWidth = 480;
 pLayerCfg.ImageHeight = 800;
 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 */
}

I got the same result. LTDC IRQ is not generated. It's enable in CubeMX. Do you have any idea?

I issue ALL_PIXELS_ON/OFF commands, and LCD goes white/black. So LCD is init'ed correctly.

Scope capture shows CLK, HSYNC, DE, non-zero RGB.

Check your PCLK DE and SYNC signals polarity with pdf

Startek signal names are confusing. So I checked them many times yesterday. Comparing scope capture and Startek pdf (below), it looks right.

0693W00000GXBJEQA5.png