cancel
Showing results for 
Search instead for 
Did you mean: 

stm32F429BI + LCD does not switch-on the display

I am starting some test with this module
https://it.aliexpress.com/item/1005002482177244.html
with 7” lcd

I have found only one example that run but with Touchgfx

I have got the same ioc from this example to generate a new code and insert the functions to switch on lcd but still no result

I would like to use the normal functions

BSP_LCD_Init() ;

BSP_LCD_DisplayStringAt(10, 80, buf, LEFT_MODE);

BSP_LCD_DrawBitmap(0, 0, (uint8_t *)(&BackGround0));

 

 

 

45 REPLIES 45

I have found this set in the example of the Alixpress module but the output result is the same

 

#define HBP 80 // ¸ù¾ÝÆÁÄ»µÄÊÖ²á½øÐÐÉèÖÃ

#define VBP 40

#define HSW 1

#define VSW 1

#define HFP 190

#define VFP 22

 

#define LCD_Width 800 

#define LCD_Height 480 

#define LCD_Pixels 800*480

#define LCD_MemoryAdd 0xD0000000 

 

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 = HSW - 1; 

hltdc.Init.VerticalSync = VSW -1 ;

hltdc.Init.AccumulatedHBP = HBP + HSW -1;

hltdc.Init.AccumulatedVBP = VBP + VSW -1;

hltdc.Init.AccumulatedActiveW = LCD_Width + HSW + HBP -1;

hltdc.Init.AccumulatedActiveH = LCD_Height + VSW + VBP -1;

hltdc.Init.TotalWidth = LCD_Width + HSW + HBP + HFP - 1;

hltdc.Init.TotalHeigh = LCD_Height + VSW + VBP + VFP - 1;

 

Need to fix BSP_RGB_LCD.c

#define XSIZE_PHYS 1024 // WRONG
#define YSIZE_PHYS 600  // WRONG

#define HBP  2 // NOT SURE WHERE USED
#define VBP  2 // BACK PORCH

#define HSW  10
#define VSW  2 // SYNC

#define HFP  2
#define VFP  2 // FRONT PORCH

Ok so a FANKE RGB070M1 800x480 V1.4 with AT070TN92 panel

https://www.beyondinfinite.com/lcd/Library/Innolux/AT070TN92.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Timing clocks in here

stm32F429BI-test2\Core\Src\stm32f4xx_hal_msp.c

You've got LTDC initialization in main.c via MX_LTDC_Init()

Back + Active + Front

Horizontal 64 + 800 + 210 = 1056

Vertical 23 + 480 + 22 = 525

Sync needs to come out of the back budget

Horizontal sync 1 - 40

Vertical sync 1 - 20

LTDC has a counter, hence the "accumulated" value so you can hit each count

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

www.audiodesignguide.com/sw1/stm32F429BI-test3.zip

near to the final result but why it is blue ?

20240423_234622.jpg

 

 

 

 

the main code:

 

HAL_GPIO_WritePin(LCD_BACKLIGHT_GPIO_Port, LCD_BACKLIGHT_Pin, GPIO_PIN_SET);

 

BSP_LCD_Init();

 

//osDelay(1000);

 

#define WHITE 0xFFFF

#define BLACK 0x0000

 

//Paint_NewImage(800, 480, 0, WHITE);

BSP_LCD_Clear(WHITE);

 

 

here the set:

 

static void MX_LTDC_Init(void)

{

LTDC_LayerCfgTypeDef pLayerCfg = {0};

LTDC_LayerCfgTypeDef pLayerCfg1 = {0};

 

#define HBP 80

#define VBP 40

#define HSW 1

#define VSW 1

#define HFP 190

#define VFP 22

 

#define LCD_Width 800

#define LCD_Height 480

#define LCD_Pixels 800*480

#define LCD_MemoryAdd 0xD0000000

 

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 = HSW - 1;

hltdc.Init.VerticalSync = VSW -1 ;

hltdc.Init.AccumulatedHBP = HBP + HSW -1;

hltdc.Init.AccumulatedVBP = VBP + VSW -1;

hltdc.Init.AccumulatedActiveW = LCD_Width + HSW + HBP -1;

hltdc.Init.AccumulatedActiveH = LCD_Height + VSW + VBP -1;

hltdc.Init.TotalWidth = LCD_Width + HSW + HBP + HFP - 1;

hltdc.Init.TotalHeigh = LCD_Height + VSW + VBP + VFP - 1;

 

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 = 799;

pLayerCfg.WindowY0 = 0;

pLayerCfg.WindowY1 = 479;

pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

pLayerCfg.Alpha = 255;

pLayerCfg.Alpha0 = 0;

pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg.FBStartAdress = 0xD0000000;

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();

}

 

pLayerCfg1.WindowX0 = 0;

pLayerCfg1.WindowX1 = 799;

pLayerCfg1.WindowY0 = 0;

pLayerCfg1.WindowY1 = 479;

pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

pLayerCfg1.Alpha = 0;

pLayerCfg1.Alpha0 = 0;

pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg1.FBStartAdress = 0;

pLayerCfg1.ImageWidth = 0;

pLayerCfg1.ImageHeight = 0;

pLayerCfg1.Backcolor.Blue = 0;

pLayerCfg1.Backcolor.Green = 0;

pLayerCfg1.Backcolor.Red = 0;

if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)

{

Error_Handler();

}

My blind stab at this would be, might be some N-1 issues

// 33.3 MHz PIXEL CLOCK  AT070TN92 / FANKE RGB070M1 800x480 V1.4

#define HSIZE_ACTIVE 800
#define VSIZE_ACTIVE 480

#define HSYNC 20
#define HBP 64
#define HFP 210

#define VSYNC 9
#define VBP 23
#define VFP 22


  hltdc.Init.HorizontalSync = HSYNC;
  hltdc.Init.VerticalSync = VSYNC;
  hltdc.Init.AccumulatedHBP = HBP;
  hltdc.Init.AccumulatedVBP = VBP;
  hltdc.Init.AccumulatedActiveW = hltdc.Init.AccumulatedHBP + HSIZE_ACTIVE;
  hltdc.Init.AccumulatedActiveH = hltdc.Init.AccumulatedVBP + VSIZE_ACTIVE;
  hltdc.Init.TotalWidth = hltdc.Init.AccumulatedActiveW + HFP;
  hltdc.Init.TotalHeigh = hltdc.Init.AccumulatedActiveH + VFP;

Guessing the LTDC clock is 25 MHz, needs to be 33.3 MHz, or so

void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hltdc->Instance==LTDC)
  {
  /* USER CODE BEGIN LTDC_MspInit 0 */

  /* USER CODE END LTDC_MspInit 0 */

  /** Initializes the peripherals clock 25/15 = 1.6667 MHz fComp
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLLSAI.PLLSAIN = 80; // 60=25MHz, 80=33.3MHz ??
    PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
    PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }

    /* Peripheral clock enable */
    __HAL_RCC_LTDC_CLK_ENABLE();
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I will try tomorrow your set

Horizontal 64 + 800 + 210 = 1056

Vertical 23 + 480 + 22 = 525

Sync needs to come out of the back budget

Horizontal sync 1 - 40

Vertical sync 1 - 20

 

ok, Tesla DeLorean 

I will test tomorrow morning

Tesla DeLorean, Your set not RUN

This RUN and show a blue screen

PeriphClkInitStruct.PLLSAI.PLLSAIN = 60;

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;



#define HBP 80

#define VBP 40

#define HSW 1

#define VSW 1

#define HFP 190

#define VFP 22

 

#define LCD_Width 800

#define LCD_Height 480

#define LCD_Pixels 800*480

#define LCD_MemoryAdd 0xD0000000

 

hltdc.Init.HorizontalSync = HSW - 1;

hltdc.Init.VerticalSync = VSW -1 ;

hltdc.Init.AccumulatedHBP = HBP + HSW -1;

hltdc.Init.AccumulatedVBP = VBP + VSW -1;

hltdc.Init.AccumulatedActiveW = LCD_Width + HSW + HBP -1;

hltdc.Init.AccumulatedActiveH = LCD_Height + VSW + VBP -1;

hltdc.Init.TotalWidth = LCD_Width + HSW + HBP + HFP - 1;

hltdc.Init.TotalHeigh = LCD_Height + VSW + VBP + VFP - 1;

 

    run
HBP80 AccumulatedHBP40
VBP40 AccumulatedVBP40
HSW1 HorizontalSync0
VSW1 VerticalSync0
HFP190 AccumulatedActiveW880
VFP22 AccumulatedActiveH520
LCD_Width800 TotalWidth1071
LCD_Height480 TotalHeigh543