2025-06-21 3:54 PM
Hi All,
I'm struggling to get LPTIM1 to wake from STOP mode on the STM32U5 series parts. I have a STM32U575ZI Nucleo board. When I use SLEEP mode, the LPTIM1_IRQHandler in stem32u5xx_it.c is hit. When I use STOP mode, it is not. I made an example with CubeMx to make it as simple as possible. I'll attach the CubeMx ioc and main.c, but see below for the snippit with all the CubeMx comments removed. Presumably its not an issue with the LPBAM, as if I set the RCC->SRDAMR to all ones, it still fails.
Any ideas?
Thanks
Jeff
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_LPTIM1_Init();
__HAL_RCC_LPTIM1_CLKAM_ENABLE();
HAL_LPTIM_Counter_Start_IT(&hlptim1);
while (1)
{
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); // Doesn't work
//???HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI); // Works
HAL_ResumeTick();
}
}
2025-06-23 10:04 AM
Hello @Jeff Gros ,
Please refer to this article which may help you: Troubleshooting waking up from stop mode issues with LPTIM in STM32U5
2025-06-23 10:12 AM
Hi Imen,
Thanks for the link. I did review this when I reviewed other posts trying to see if this was already solved. Regarding the article:
1. I'm using LPTIM1 clocked from LSI. Since I'm clocked from LSI, the clock source should persist in STOP modes. LPTIM1 shouldn't have any restrictions with any of the STOP modes but what I observe is that it fails to wake in all the stop modes, not just STOP2.
2. __HAL_RCC_LPTIM1_CLKAM_ENABLE is present in the code above. As mentioned, if I set RCC->SRDAMR to all ones, it still will not wake.
3. LPTIM1 is not being disabled.
Thanks for the link, but I don't think any of these apply.
Thanks
Jeff
2025-06-27 10:02 AM
Has anyone had success getting this feature to work? I've not made any progress on this so far and would appreciate some help.
2025-08-25 8:00 PM
I had a chance to spend some time on this recently. It appears to be entirely a debug interaction.
I found that the ISR was executing, but the debugger could not halt on any breakpoint set before stop mode was initiated (proved code in ISR was executing by toggling a debug port pin and observing with oscilloscope). I didn't quite get to the bottom of the issue because I could not reproduce it on the eval kit, and I ended up accidentally fixing it on my real hardware. It is now 'fixed' even across complete power cycles.
DBGMCU->CR has the DBG_STANDBY and DBG_STOP bits set by IAR, so this should not be the issue. And DBG_LPTIM1_STOP was not set in APB3FZR, so the LPTIM should have been clocked in stop mode (by LSI). Before the issue suddenly fixed itself, I had tried adding RTC (also clocked by LSI), which worked.
The good news is appears to be a debug issue and not a production issue, but I would like to understand it better if possible.