cancel
Showing results for 
Search instead for 
Did you mean: 

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

FLuba.1
Senior

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

 

4 REPLIES 4
Andrew Neil
Super User

@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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

"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

 


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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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.