2024-01-18 04:25 PM
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.
Solved! Go to Solution.
2024-01-20 12:45 PM - edited 2024-01-20 12:59 PM
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?
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 */
}
}
2024-01-20 02:18 PM
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;
2024-01-20 03:18 PM
@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.
2024-01-20 04:23 PM
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.
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
2024-01-21 01:35 AM
Dear @PhilipC ,
Great ! And yes , it happens to all of us :) .
@Tesla DeLorean Merci !
Ciao,
STOne-32