LTDC won't initialize with the STM32H753
Hello!
I'm using the Cube IDE with STM32H753 and trying to initialize the LTDC from HAL.
I already did this with success for the STM32F767.
But for the STM32H753 I have some problems with LTDC drivers.
The programm hangs up during debugging on the automatic genarated initialization routine.
The main looks like this:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_LTDC_Init();And the problem is the MX_LTDC_Init();
The program goes into it (inside the ltdc.c file):
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 = 9;
hltdc.Init.VerticalSync = 1;
hltdc.Init.AccumulatedHBP = 29;
hltdc.Init.AccumulatedVBP = 5;
hltdc.Init.AccumulatedActiveW = 269;
hltdc.Init.AccumulatedActiveH = 325;
hltdc.Init.TotalWidth = 279;
hltdc.Init.TotalHeigh = 329;
hltdc.Init.Backcolor.Blue = 0;
hltdc.Init.Backcolor.Green = 0;
hltdc.Init.Backcolor.Red = 200;
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_CA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
pLayerCfg.FBStartAdress = 0;
pLayerCfg.ImageWidth = 220;
pLayerCfg.ImageHeight = 320;
pLayerCfg.Backcolor.Blue = 0;
pLayerCfg.Backcolor.Green = 0;
pLayerCfg.Backcolor.Red = 250;
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
{
Error_Handler();
}
}And then hangs on the HAL_LTDC_Init line.
Going further into that it looks like the problem is with the line 58:
HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc)
{
uint32_t tmp, tmp1;
/* Check the LTDC peripheral state */
if (hltdc == NULL)
{
return HAL_ERROR;
}
/* Check function parameters */
assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance));
assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync));
assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync));
assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP));
assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP));
assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH));
assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW));
assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh));
assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth));
assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity));
assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity));
assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity));
assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity));
#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
if (hltdc->State == HAL_LTDC_STATE_RESET)
{
/* Allocate lock resource and initialize it */
hltdc->Lock = HAL_UNLOCKED;
/* Reset the LTDC callback to the legacy weak callbacks */
hltdc->LineEventCallback = HAL_LTDC_LineEventCallback; /* Legacy weak LineEventCallback */
hltdc->ReloadEventCallback = HAL_LTDC_ReloadEventCallback; /* Legacy weak ReloadEventCallback */
hltdc->ErrorCallback = HAL_LTDC_ErrorCallback; /* Legacy weak ErrorCallback */
if (hltdc->MspInitCallback == NULL)
{
hltdc->MspInitCallback = HAL_LTDC_MspInit;
}
/* Init the low level hardware */
hltdc->MspInitCallback(hltdc);
}
#else
if (hltdc->State == HAL_LTDC_STATE_RESET)
{
/* Allocate lock resource and initialize it */
hltdc->Lock = HAL_UNLOCKED;
/* Init the low level hardware */
HAL_LTDC_MspInit(hltdc);
}
#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
/* Change LTDC peripheral state */
hltdc->State = HAL_LTDC_STATE_BUSY;
/* Configure the HS, VS, DE and PC polarity */
hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL);
hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \
hltdc->Init.DEPolarity | hltdc->Init.PCPolarity);The debugger says this:


So it looks like the Instance is initialized with zeros. But why?
Like I wrote , the code is automatic generated, so I don't delete anythig or write anything into the Init functions.
How can I deep deeper to see what could be the problem?
The application shall just display a simple one color picture first.
Thank you and regards,
Gregor
