cancel
Showing results for 
Search instead for 
Did you mean: 

LTDC not generating clock

PhilipC
Associate III

Hi,

I have a Nucleo-U5A5ZJ-Q board which i replace the mcu with a STM32U5A9ZJT6.

I'm trying to use LTDC to control a 800x480 LCD (WF50FTYAGDNN0#) via RGB888.

Eventually running touchgfx, but I have fallen over at the first hurdle.

I have read many tutorials and forum posts and no one seems to have the same issue as me.

 

I started a blank project and followed this

https://support.touchgfx.com/docs/development/board-bring-up/how-to/03-display-internal

But my display remains a black screen, I then probed PD3 (LTDC_CLK) where I expected the 25Mhz clock signal that was configured, but saw nothing. 

I also tried switching the pins "Max output speed" to Very High as I saw somewhere that this was required.

I then switched PD3 to GPIO_Output and toggled it to make sure connections are correct.

 

Is there something wrong with my clock setup? I tried a test of toggling a pin in the while loop with a 1ms delay and the scope says a full cycle took 4ms instead of the expected 2ms... but then I set the delay to 10ms and eveything is as expected on the scope.

 

Note about the display: it doesn't have Hsync and Vsync lines I assume this means it is permanently in DE mode and I can leave those pins floating from the mcu?

 

Any help would really be appreciated as I have been going at this for a couple of days now.

1 ACCEPTED SOLUTION

Accepted Solutions

@STOne-32 is it possible this could have been fused like the U5A5 with the LTDC disabled? All peripheral registers are presenting as stuck-at-zero

@PhilipC can you provide a clear picture of the top markings of the IC you mounted.

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

View solution in original post

14 REPLIES 14
PhilipC
Associate III

I observed the registers as i stepped through the HAL_LTDC_Init() and none of the LTDC registers are being updated, so LTDC is never setup nor enabled as they aren't being written to... what could cause this?

PhilipC_0-1705696434657.png

The init vars do have the cubemx values in them

PhilipC_2-1705696636884.png

 

 

Make sure the LTDC clock is explicitly enabled in the RCC

LTDCEN in RCC_APB2ENR

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

Yes, this is set.

PhilipC_0-1705699299594.png

 

And all the registers are still stuck-at-zero?

There's an AHB clock, and an LCD_CLK, but the APB one is supposed to allow for register access.

Check the chip identifications

  printf("CPUID %08X DEVID %03X REVID %04X\n", SCB->CPUID, DBGMCU->IDCODE & 0xFFF, (DBGMCU->IDCODE >> 16) & 0xFFFF);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes, LTDC registers still stuck on 0.

Sorry, I don't know what these IDs are for.

 

CPUID 410FD214 DEVID 481 REVID 3001

 

Establishing what core/step you have, to relate to the issue or errata

0x481: STM32U59x/5Ax,  0x3001: revision X

And your HAL_LTDC_MspInit() looks materially similar to

/**
* @brief LTDC MSP Initialization
* This function configures the hardware resources used in this example
* @PAram hltdc: LTDC handle pointer
* @retval None
*/
void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
{
  if(hltdc->Instance==LTDC)
  {
  /* USER CODE BEGIN LTDC_MspInit 0 */

  /* USER CODE END LTDC_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_LTDC_CLK_ENABLE();
    /* LTDC interrupt Init */
    HAL_NVIC_SetPriority(LTDC_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(LTDC_IRQn);
    HAL_NVIC_SetPriority(LTDC_ER_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(LTDC_ER_IRQn);
  /* USER CODE BEGIN LTDC_MspInit 1 */

  /* USER CODE END LTDC_MspInit 1 */
  }
}

 

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

Mine has got the GPIO setup in it aswell but yeah.
I also tried adding restart and release after the clk enable but made no difference.

 

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

  /* USER CODE END LTDC_MspInit 0 */

  /** Initializes the peripherals clock
  */
    PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInit.LtdcClockSelection = RCC_LTDCCLKSOURCE_PLL2;
    PeriphClkInit.PLL2.PLL2Source = RCC_PLLSOURCE_HSE;
    PeriphClkInit.PLL2.PLL2M = 1;
    PeriphClkInit.PLL2.PLL2N = 9;
    PeriphClkInit.PLL2.PLL2P = 2;
    PeriphClkInit.PLL2.PLL2Q = 2;
    PeriphClkInit.PLL2.PLL2R = 6;
    PeriphClkInit.PLL2.PLL2RGE = RCC_PLLVCIRANGE_1;
    PeriphClkInit.PLL2.PLL2FRACN = 3072.0;
    PeriphClkInit.PLL2.PLL2ClockOut = RCC_PLL2_DIVR;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
    {
      Error_Handler();
    }

    /* Peripheral clock enable */
    __HAL_RCC_LTDC_CLK_ENABLE();

    __HAL_RCC_GPIOE_CLK_ENABLE();
    __HAL_RCC_GPIOF_CLK_ENABLE();
    __HAL_RCC_GPIOD_CLK_ENABLE();
    /**LTDC GPIO Configuration
    PE2     ------> LTDC_R0
    PE3     ------> LTDC_R1
    PE4     ------> LTDC_B0
    PE5     ------> LTDC_G0
    PE6     ------> LTDC_G1
    PF13     ------> LTDC_B1
    PE7     ------> LTDC_B6
    PE8     ------> LTDC_B7
    PE9     ------> LTDC_G2
    PE10     ------> LTDC_G3
    PE11     ------> LTDC_G4
    PE12     ------> LTDC_G5
    PE13     ------> LTDC_G6
    PE14     ------> LTDC_G7
    PE15     ------> LTDC_R2
    PD8     ------> LTDC_R3
    PD9     ------> LTDC_R4
    PD10     ------> LTDC_R5
    PD11     ------> LTDC_R6
    PD12     ------> LTDC_R7
    PD14     ------> LTDC_B2
    PD15     ------> LTDC_B3
    PD0     ------> LTDC_B4
    PD1     ------> LTDC_B5
    PD3     ------> LTDC_CLK
    PD6     ------> LTDC_DE
    PE0     ------> LTDC_HSYNC
    PE1     ------> LTDC_VSYNC
    */
    GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
                          |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9
                          |GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13
                          |GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF8_LTDC;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_13;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF8_LTDC;
    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
                          |GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0
                          |GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_6;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF8_LTDC;
    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

    /* LTDC interrupt Init */
    HAL_NVIC_SetPriority(LTDC_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(LTDC_IRQn);
    HAL_NVIC_SetPriority(LTDC_ER_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(LTDC_ER_IRQn);
  /* USER CODE BEGIN LTDC_MspInit 1 */

  /* USER CODE END LTDC_MspInit 1 */
  }

}

 

PhilipC
Associate III

I tried the following and LTDC register will not accept anything.

LTDCRST = 0

LTDCEN = 1

 

  while (1)
  {
    /* USER CODE END WHILE */
	  temp = LTDC->GCR;
	  LTDC->GCR = 1;
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

 

 

Could it be something with my clock setup?

PhilipC_0-1705748467213.png

PhilipC_2-1705748518399.png

 

I added an I2C peripherial and after MX_I2C1_Init() i can see values in the I2C registers, but nothing for LTDC...

 

 

 

waclawekjan_0-1705782910105.png

So, which one is it, PLL2 or PLL3?

Read out and check/post relevant RCC registers content.

JW