ago in System Integration by

Hi I am using a STM32H747 MCU with Embedded wizard.

and I am operating an LCD using LTDC not DSI.

Screen Flickering occurs every time the time is updated on the screen.

The LTDC settings are as follows.

    #define LCD_HSYNC 5
    #define LCD_WIDTH 1024
    #define LCD_VFP 12
    #define LCD_HFP 160
    #define LCD_VSYNC 5
    #define LCD_VBP 23
    #define LCD_HEIGHT 600
    #define LCD_SDRAM_ADDRESS 0xD0000000
    #define LCD_HBP 160
    #define PIN_LCD_Backlight_Ctrl_Pin GPIO_PIN_15
    #define PIN_LCD_Backlight_Ctrl_GPIO_Port GPIOE

    static void MX_LTDC_Init(void)

        LTDC_LayerCfgTypeDef pLayerCfg = {0};

        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 = 3;
        hltdc.Init.VerticalSync = LCD_VSYNC - 1;
        hltdc.Init.AccumulatedHBP = LCD_HSYNC + LCD_HBP - 1;
        hltdc.Init.AccumulatedVBP = LCD_VSYNC + LCD_VBP - 1;
        hltdc.Init.AccumulatedActiveW = LCD_WIDTH + LCD_HSYNC + LCD_HBP - 1;
        hltdc.Init.AccumulatedActiveH = LCD_HEIGHT + LCD_VSYNC + LCD_VBP - 1;
        hltdc.Init.TotalWidth = LCD_WIDTH + LCD_HSYNC + LCD_HBP + LCD_HFP - 1;
        hltdc.Init.TotalHeigh = LCD_HEIGHT + LCD_VSYNC + LCD_VBP + LCD_VFP - 1;
        hltdc.Init.Backcolor.Blue = 0;
        hltdc.Init.Backcolor.Green = 0;
        hltdc.Init.Backcolor.Red = 0;
        if (HAL_LTDC_Init(&hltdc) != HAL_OK)
        pLayerCfg.WindowX0 = 0;
        pLayerCfg.WindowX1 = LCD_WIDTH;
        pLayerCfg.WindowY0 = 0;
        pLayerCfg.WindowY1 = LCD_HEIGHT;
        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 = (uint32_t)LCD_SDRAM_ADDRESS;
        pLayerCfg.ImageWidth = LCD_WIDTH;
        pLayerCfg.ImageHeight = LCD_HEIGHT;
        pLayerCfg.Backcolor.Blue = 0;
        pLayerCfg.Backcolor.Green = 0;
        pLayerCfg.Backcolor.Red = 0;
        if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
        /* USER CODE BEGIN LTDC_Init 2 */
        LayerConfig = pLayerCfg;

        /* USER CODE END LTDC_Init 2 */


The clock settings for LTDC are as follows, The configured clock frequency is 12.3MHz

( When I set the clock to around 51MHz, the screen is broken).

    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLL3.PLL3M = 5;
    PeriphClkInitStruct.PLL3.PLL3N = 160;
    PeriphClkInitStruct.PLL3.PLL3P = 2;
    PeriphClkInitStruct.PLL3.PLL3Q = 2;
    PeriphClkInitStruct.PLL3.PLL3R = 65;
    PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_2;
    PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOWIDE;
    PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)

The following is the configuration status of ewconfig.h

    #define SDRAM_BASE_ADDR       0xD0000000
    #define SDRAM_SIZE_BYTES      0x2000000

    #define EW_DISPLAY_WIDTH                1024
    #define EW_DISPLAY_HEIGHT               600

    #define EW_FRAME_BUFFER_WIDTH           1024
    #define EW_FRAME_BUFFER_HEIGHT          600

If the time is not updated, the screen is displayed normally. However, when updating, flickering occurs.

I want to get various things to check and solutions to solve the problem.

Please Help me.


1 Answer

0 votes
ago by

it seems that there is some memory bandwidth issue - means, that the LTDC does not get enough data during ongoing activities of DMA2D and CPU.

Have you checked your display settings and pixel clock frequency with the recommendation of AN4861 from ST?

How is your SDRAM connected? Is it 16bit or 32 bit?

Btw: Which color format are you using (within the Platform Package)?

Best regards,
ago by

Thank you for your response.

My SDRAM data pins have 8bits

and color format is RGB565


Now I set the clock for LTDC to 10MHz. The flickering on the screen has disappeared.

But I don't think ths is set correctly.


I first tested on a 480x272 screen based on the embedded widzard provided for stm32h745-discovery.

and then I changed LCD resolution to 1024x600 screen.

So I changed each part that was 480x272 to 1024x600

Could you let me know which parts need to be changed more when the resolution is changed?

thank you
ago by

to be honest, I suspect that the display does not fit to your hardware.

If you want to operate a display with 1024x600 the necessary pixel clock frequency is 42...52 MHz to achieve a display refresh rate of 50...60 Hz. Due to the fact that the SDRAM is connected with only 8 bits, the maximum pixel clock frequency will be more or less 10...15 MHz - so you get a display refresh rate of 12...17 Hz.

Best regards,

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint