2025-06-11 9:57 AM
Hi everyone,
I'm working with an STM32U5 and using USBX with the CDC-ACM class.
My setup is as follows:
I have a USBX CDC ACM receive thread that calls usbx_cdc_acm_read_thread_entry() in ux_device_cdc_acm.c file.
Alongside, I have a state machine running in another context (main loop).
If the device stays idle (no USB activity) for a certain timeout, the state machine puts the MCU into Sleep Mode using:
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
HAL_ResumeTick();
The goal is to wake up the MCU only when data is received on the USB.
To achieve this, I tried relying on USB interrupts:
OTG_FS_IRQn is enabled in NVIC.
The USB OTG FS peripheral is initialized properly via HAL_PCD_Init().
OTG_FS_IRQHandler() is defined and calls HAL_PCD_IRQHandler()
But I'm not getting out from the Sleep mode, I'm completely stuck and running out of ideas.
Any assistance would be greatly appreciated.
Thank you!
2025-07-03 8:18 AM
Update,
So I managed to get to STOP mode. I have a state machine that can change state in asynchronous or synchronous way and I managed to put it in STOP mode in asynchronous way.
I can wake up if I click in a key in the keyboard but the temperature of the board is not dropping, don't know why. I can see that it entered in STOP mode because I've a LED that is toggling while the program is running, and when it gets to STOP mode it stops toggling. The thing is, temperature is not dropping. I guess something is missing.
2025-07-03 9:45 AM
Hi @j_filipe
Maybe a heat sink could help in your case?
if your initial questions have been resolved, you can close the thread by marking the most helpful response as accepted to adhere to community guidelines.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-04 2:07 AM
Hi FBL,
So, the situation that I mentioned yesterday, it only worked for Stop mode, not for Sleep mode. The device doesn't overheat, so there's no need for an heat sink, but while in idle, the temperature reaches undesirable levels, hence the sleep or stop mode. Since the device reaches the same level of temperature in Stop mode (same as Idle), I guess that something is not right.
Should I create a new thread for this situation?
Thank you.