cancel
Showing results for 
Search instead for 
Did you mean: 

LTDC broken cfg from TouchGFX BSP of CubeMX 5.0.1.. how to debug?

andrea venturi
Associate III

hello, i'm testing a simple TouchGFX BSP coming out of the CubeMX 5.0.1 (i know it's not the latest, anyway...)

it's a project "configured" for Atollic Truestudio 6.3. after some tweaks here and there (thanx to a lot of report, online..) i've been able to compile and run it on my STM32F429I-DISC1 dev board. so far so good!

first issue: i had to override the LTDC_ER_IRQHandler() because it was raising the LTDC FUIF (fifo underrun.. maybe it's related to the next issue)

Now i'm facing the "issue" you can see in the attached image, where you can see the Discover board (with a 240x320 display, portrait mode) showing incorrectly the framebuffer. instead of filing the LCD with the full 240x320 Screen, i made in TouchGFX Designer, the graphic is "cut" at two/third, and black on the right side. it looks like an issue about "overdriving" the pixel clock (and that could explain the underrun IRQ before..)

Here the params of the LTDC; where do i find a good set for a check?

void MX_LCD_Init(void)

{

 LTDC_LayerCfgTypeDef pLayerCfg;

 ili9341_Init();

/* 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 = 9;

 hltdc.Init.VerticalSync = 1;

 hltdc.Init.AccumulatedHBP = 29;

 hltdc.Init.AccumulatedVBP = 3;

 hltdc.Init.AccumulatedActiveW = 269;

 hltdc.Init.AccumulatedActiveH = 323;

 hltdc.Init.TotalWidth = 279;

 hltdc.Init.TotalHeigh = 327;

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

 pLayerCfg.WindowY0 = 0;

 pLayerCfg.WindowY1 = 320;

 pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;

 pLayerCfg.Alpha = 255;

 pLayerCfg.Alpha0 = 0;

 pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;

 pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;

 pLayerCfg.FBStartAdress = 0xD0000000;

 pLayerCfg.ImageWidth = 240;

 pLayerCfg.ImageHeight = 320;

 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, 320, 0);

}

maybe somebody has already seen this kind of behaviour.. and it's just an easy fix

3 REPLIES 3
Martin KJELDSEN
Chief III

Hi,

We may some some time and frustration here. Could you give this a read? https://touchgfx.zendesk.com/hc/en-us/articles/360021620431-Configuring-STM32F429I-DISCO

This article details what to do to get the F429i-DISCO board running using 5.0.1. It's for EWARM and gcc, but some of the info is general.

The designer Application Template that contain these very changes is not public yet, but i'll try to get that done. Then you could base your project on that and the LTDC configuration should be good. In fact, i don't see why you should be having issues because i didn't have to modify the LTDC config at all when i created this project (i'm pretty sure).

/Martin

i missed that document, indeed. this was really great advice.

had to change the 25->6MHz on the lower right in the shot and it did it!

practically it was a matter of these PLL registers:

diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp
index 3cb3dd6..0e21293 100644
--- a/Core/Src/main.cpp
+++ b/Core/Src/main.cpp
@@ -235,9 +237,9 @@ void SystemClock_Config(void)
    Error_Handler();
  }
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
- PeriphClkInitStruct.PLLSAI.PLLSAIN = 50;
- PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
- PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
+ PeriphClkInitStruct.PLLSAI.PLLSAIN = 60;
+ PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
+ PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)

then, i followed the touchscreen fixings and i was up and running with the TouchGFX working ok!

thanx again

Oops, i forgot about that modification! Great that it's working now 🙂