cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746NG Discovery LTDC instance not updated

PMain.1
Associate

Hello,

I am trying to display an image on the LCD of my STM32F746NG Discovery board following the example 6.2 of the AN4861, which luckily uses the same board with the same LCD. I manage to complete all the steps until the end of section 6.2.5 (page 86). When I run the project, the LCD turns from white (default) to black, but it stays black and it doesn't show my image.

When I debug I see that the LCD turns black inside the function HAL_LTDC_Init, in the call to __HAL_LTDC_ENABLE. In all this function the parameters of the hltdc Instance are changed and I can see in the variable tracker how they are changed.

However if I continue debugging, when I reach the call to HAL_LTDC_ConfigLayer, which I guess is the method responsible to set the image, it doesn't seem to work well. If you see below, in line 21 the state gets changed correctly, in line 24 the layer configuration seems to be updated, in line 27 nothing seems to happen and then in line 30 the SRCR register is not changed i the variable tracker (it should be set to 1). The mothed returns correctly and no error is reported, nor any interruption.

HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
{
  /* Check the parameters */
  assert_param(IS_LTDC_LAYER(LayerIdx));
  assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
  assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
  assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
  assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
  assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
  assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha));
  assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0));
  assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
  assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
  assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth));
  assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight));
 
  /* Process locked */
  __HAL_LOCK(hltdc);
 
  /* Change LTDC peripheral state */
  hltdc->State = HAL_LTDC_STATE_BUSY;
 
  /* Copy new layer configuration into handle structure */
  hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
 
  /* Configure the LTDC Layer */
  LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
 
  /* Set the Immediate Reload type */
  hltdc->Instance->SRCR = LTDC_SRCR_IMR;
 
  /* Initialize the LTDC state*/
  hltdc->State  = HAL_LTDC_STATE_READY;
 
  /* Process unlocked */
  __HAL_UNLOCK(hltdc);
 
  return HAL_OK;
}

Any idea what's going on? Thanks!

1 REPLY 1

Isn't there a working example in the 'F7 Cube? You could then read out and compare registers.

> in line 27 nothing seems to happen

Walk through the function it calls and observe. Make sure all relevant clocks in RCC and pins in GPIO are previously enabled and set as expected.

LTDC_SRCR self-clears when the update happens (which from human point of view is instantaneously), see manual.

JW