Skip to main content
Graduate II
June 10, 2025
Question

LTDC prevents CPU (of MCU) from going into sleep mode

  • June 10, 2025
  • 1 reply
  • 411 views

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());

 

    This topic has been closed for replies.

    1 reply

    Super User
    June 10, 2025

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

    AndrewNeil_0-1749549772232.png

    https://www.st.com/resource/en/datasheet/stm32l4p5zg.pdf#page=28

    FLuba.1Author
    Graduate II
    June 10, 2025

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

    FLuba1_0-1749554985697.png

    FLuba1_1-1749555087628.pngFLuba1_2-1749555142787.png

     

    Super User
    June 10, 2025

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