2025-06-10 2:06 AM - last edited on 2025-06-10 2:34 AM by Andrew Neil
LTDC prevents CPU (of my MCU) from going into sleep mode. When i deactivate the LTDC clock, the CPU goes to sleep mode. LTDC interrupt is enabled trough IOC, without enabling of LTDC interrupt, screen remains black. I use the following MCU: STM32L4P5ZGT6P, IDE: STM32CubeIDE 1.11.2. Does someone know why this happens?
An extract of my code:
/* Clock of used hardwares on MCU is deactivated.
*/
__HAL_RCC_DMA1_CLK_DISABLE();
__HAL_RCC_I2C1_CLK_DISABLE();
__HAL_RCC_OSPI2_CLK_DISABLE();
__HAL_RCC_TIM6_CLK_DISABLE();
__HAL_RCC_TIM2_CLK_DISABLE();
__HAL_RCC_TIM3_CLK_DISABLE();
__HAL_RCC_USART2_CLK_DISABLE();
__HAL_RCC_UART4_CLK_DISABLE();
__HAL_RCC_UART5_CLK_DISABLE();
/*Suspend Tick increment to prevent wakeup by Systick interrupt.
Otherwise the Systick interrupt will wake up the device within 1ms (HAL time base)*/
HAL_SuspendTick();
//CPU shall enter sleep mode after this instruction
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFE);
HAL_ResumeTick();
//Once HAL_ResumeTick() is called, the SysTick interrupt will be enabled and so Tick increment is resumed.
__HAL_RCC_DMA1_CLK_ENABLE();
__HAL_RCC_I2C1_CLK_ENABLE();
__HAL_RCC_OSPI2_CLK_ENABLE();
__HAL_RCC_TIM6_CLK_ENABLE();
__HAL_RCC_TIM2_CLK_ENABLE();
__HAL_RCC_TIM3_CLK_ENABLE();
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_UART4_CLK_ENABLE();
__HAL_RCC_UART5_CLK_ENABLE();
HAL_Delay(500);
printf("CPU has woke up. Clk = %ld \r\n", HAL_RCC_GetHCLKFreq());
2025-06-10 2:37 AM - edited 2025-06-10 3:03 AM
@FLuba.1 wrote:LTDC prevents CPU (of my MCU) from going into sleep mode.
How do you know that it actually prevents entering sleep?
@FLuba.1 wrote:When i deactivate the LTDC clock, the CPU goes to sleep mode. LTDC interrupt is enabled trough IOC
Maybe it does enter sleep, but then there's an LTDC interrupt which immediately wakes it?
PS:
https://www.st.com/resource/en/datasheet/stm32l4p5zg.pdf#page=28
2025-06-10 4:32 AM
"Maybe it does enter sleep, but then there's an LTDC interrupt which immediately wakes it?"
My bad, I had to write "cpu doesn't remain in sleep".
LTDC interrupt, is a interrupt. I tought, by using "PWR_SLEEPENTRY_WFE", problem would be solved, but problem remained.
Are there any solution for my problem?
According to the following AN, it should be possible to enter sleep mode(and remain in sleep mode) while using LTDC.
2025-06-10 4:55 AM
@FLuba.1 wrote:According to the following AN, it should be possible to enter sleep mode(and remain in sleep mode) while using LTDC.
Yes, but you need to ensure that it's not generating interrupts - because interrupts will wake the CPU...
2025-06-10 8:07 AM
Yes, i understand. I have tried in the past, to let the screen work without interrupt, it didn't work. Can LTDC let a screen work without interrupt?
I will try it again. I hope i won't take me a lot of time.