cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 don't enter sleep mode,but CDC_Transmit_FS fails!!

HAlzo
Senior

I am trying to put STM32H743 into sleep mode using the following code

printf("Entering Sleep Mode\n");
	HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON ,  PWR_SLEEPENTRY_WFI);
	printf("Exiting Sleep Mode\n");

I notice that my microcontroller dont go into sleep mode but it continue execution to the last printf instruction

the printf is mapped to use USB CDC,so it propagates to CDC_Transmit_FS() function which returns busy status after executing the HAL_PWR_EnterSLEEPMode() function

How could I overcome this problem?

Best Regards

Hossam Alzomor

5 REPLIES 5
TDK
Guru

If the USB is active, it's probably generating interrupts which wake up the system.

If you feel a post has answered your question, please click "Accept as Solution".

So , Should I disable the USB before going to Sleep Mode?

Piranha
Chief II

First read what a SLEEP and other low-power modes are and how they differ.

I have already did.

If you have something specific that you recommend me reading, kindly let me know.

Piranha
Chief II

RM0433 section 6.7 describes low-power modes pretty clearly. Read it over and over until you understand it. And keep in mind that terms matter - a CPU is not a MCU.