Skip to main content
Associate III
January 19, 2024
Solved

LTDC not generating clock

  • January 19, 2024
  • 7 replies
  • 6955 views

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.

This topic has been closed for replies.
Best answer by Tesla DeLorean

@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.

7 replies

PhilipCAuthor
Associate III
January 19, 2024

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

 

 

Tesla DeLorean
Guru
January 19, 2024

Make sure the LTDC clock is explicitly enabled in the RCC

LTDCEN in RCC_APB2ENR

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
PhilipCAuthor
Associate III
January 19, 2024

Yes, this is set.

PhilipC_0-1705699299594.png

 

PhilipCAuthor
Associate III
January 20, 2024

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...

 

 

 

waclawek.jan
Super User
January 20, 2024

waclawekjan_0-1705782910105.png

So, which one is it, PLL2 or PLL3?

Read out and check/post relevant RCC registers content.

JW

PhilipCAuthor
Associate III
January 20, 2024

Ah sorry I flipped to PLL3 when experimenting stuff, the code does now also point to PLL3.

Does this look like the PLL3 registers aren't reflecting what the code says?

PhilipC_0-1705783400736.png

 

PhilipC_1-1705783484734.png

PhilipC_2-1705783493649.png

PhilipC_0-1705784187209.png

PhilipC_1-1705784339844.png

 

 

 

 

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_PLL3;
 PeriphClkInit.PLL3.PLL3Source = RCC_PLLSOURCE_HSE;
 PeriphClkInit.PLL3.PLL3M = 1;
 PeriphClkInit.PLL3.PLL3N = 15;
 PeriphClkInit.PLL3.PLL3P = 2;
 PeriphClkInit.PLL3.PLL3Q = 2;
 PeriphClkInit.PLL3.PLL3R = 10;
 PeriphClkInit.PLL3.PLL3RGE = RCC_PLLVCIRANGE_1;
 PeriphClkInit.PLL3.PLL3FRACN = 3072;
 PeriphClkInit.PLL3.PLL3ClockOut = RCC_PLL3_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 */
 }

}

 

 

 

PhilipCAuthor
Associate III
January 20, 2024

I just tried SAI2 peripheral as it is also on APB2, and it can write to its config registers fine.
I can also write to them and read them fine, so something specific to LTDC.
All the documentation I can find just points to LTDCEN being enabled before writing and nothing else, I'm really at a loss here.

SAI2->GCR = 1;

PhilipC_0-1705789070072.png

 

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
January 20, 2024

@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 VenmoUp vote any posts that you find helpful, it shows what's working..
PhilipCAuthor
Associate III
January 21, 2024

So I went to take a photo and couldn't believe my eyes...
I must have got the chips swapped at somepoint after removing the A5.

I have now swapped the A9 on and sure enough getting all the registers and a LTDC_CLK.
Thank you for your input and sorry for the confusion.

419924620_403859895540427_6950154695331396575_n.jpg

The display is now cycling through Black, White, Red, Green, Blue even though I have an empty while(1) but atleast it's a new problem.

I feel like a *** bashing my head against a wall for the past week only to find out I took the A5 off and put it back on... Thank you for you time @Tesla DeLorean 

STOne-32
Technical Moderator
January 21, 2024

Dear @PhilipC ,

 

Great !  And yes , it happens to all of us :) . 

@Tesla DeLorean  Merci ! 

Ciao,

 

STOne-32