cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746 + 5.0�? TFT + TouchGFX on custom board

SKokk.1
Associate II

Hello,

I am building a custom board based on the STM32F746's discovery.

I have already used the STM32CubeIDE 1.1.0 with TouchGFX 4.12.3 om discovery and everything is working fine.

Custom board has the same hardware with discovery but we are using different TFT screen (attached PDF).

The TFT on my board displays:0693W000001pKYnQAM.png

I am not sure about the LTDC parameters based on the new TFT. I have set the below:

void MX_LCD_Init(void) 
{ 
 LTDC_LayerCfgTypeDef pLayerCfg;
 
/* De-Initialize LTDC */
  HAL_LTDC_DeInit(&hltdc);
/* Configure LTDC */
 
  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 = 49;
  hltdc.Init.VerticalSync = 4;
  hltdc.Init.AccumulatedHBP = 89;
  hltdc.Init.AccumulatedVBP = 33;
  hltdc.Init.AccumulatedActiveW = 889;
  hltdc.Init.AccumulatedActiveH = 513;
  hltdc.Init.TotalWidth = 929;
  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_RGB888;
  pLayerCfg.Alpha = 255;
  pLayerCfg.Alpha0 = 0;
  pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
  pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
  pLayerCfg.FBStartAdress = 0xC0000000;
  pLayerCfg.ImageWidth = 480;
  pLayerCfg.ImageHeight = 272;
  pLayerCfg.Backcolor.Blue = 0;
  pLayerCfg.Backcolor.Green = 0;
  pLayerCfg.Backcolor.Red = 0;
  if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
  {
    Error_Handler( );
  }
 
 HAL_LTDC_SetPitch(&hltdc, 800, 0);
 
}

Could someone help me or advise?

10 REPLIES 10
void MX_LCD_Init(void) 
{ 
 LTDC_LayerCfgTypeDef pLayerCfg;
 
/* De-Initialize LTDC */
  HAL_LTDC_DeInit(&hltdc);
/* Configure LTDC */
 
  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 = 47;
  hltdc.Init.AccumulatedHBP = 87;
  hltdc.Init.AccumulatedActiveW = 887;
  hltdc.Init.TotalWidth = 927;
 
  hltdc.Init.VerticalSync = 2;
  hltdc.Init.AccumulatedVBP = 31;
  hltdc.Init.AccumulatedActiveH = 511;
  hltdc.Init.TotalHeigh = 524;
 
  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_RGB888;
  pLayerCfg.Alpha = 255;
  pLayerCfg.Alpha0 = 0;
  pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
  pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
  pLayerCfg.FBStartAdress = 0xC0000000;
  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( );
  }
}

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

Hi,

I have not seen your datasheet​

But If your schematic/connections is correct

Did you compare the paramters of both the TFT/LCD ​such as VSYNC, HSYNC, Vertical Porch Horizontal Portch etc.? as in program.

Also you can put scope on DE, VSYNC, HSYNC,Reset pin​ etc of TFT?

​Check your TFT Works with DE/Sync check both Datasheets? For code compatibility.

Hope this helps... ​

--

Karan​

SKokk.1
Associate II

Thank you for your answers.

I fixed the parameters but still problem. Then i changed the Pixel format to:

pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;

And it worked.

0693W000001pKm1QAE.png

On TouchGFX project the Pixel format is "locked" to 16bit. Is there a way to change it to 24bit or i should create new TouchGFX project?

0693W000001pKmQQAU.png

Hi

Just Create new Touchgfx project and ​then try...

--

Karan​

That does look a lot better...

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

Worked with RGB888 setup too, thank you guys.

0693W000001pKybQAE.jpg

Great!!!

SKokk.1
Associate II

Something else,

why does simulation and real hardware application is different?

I run simulation on TouchGFX designer and everything is good (using some animated pictures from examples) but when i load on hardware, animations seems not working.

https://www.youtube.com/watch?v=e0laQf_d6l8

Seems like maybe your application is not being ticked - Can you break inside Model::tick() and check ? The tick is what drives the application including the animated images.