cancel
Showing results for 
Search instead for 
Did you mean: 

Port application from STM32L4 to STM32U5 waking from STOP2 by LPUART, RTC etc

STayl.7
Associate II

This isn't a question - I just spent a LONG time finding this so I figured I'd post my solution in case anyone else runs into it.

The STM32U5 seems largely backward compatible with STM32L4 source code, but in order to have certain low power peripherals wake the CPU from STOP2 mode there is one extra step I had to take - and it wasn't completely obvious to me and took a long time to stumble across.

By default the RTC will NOT wake the CPU from STOP2 - although the RTC will continue to run, and it will generate interrupts - which can be seen in the NVIC ISPR. I couldn't figure out why the RTC was running and generating a pending interrupt (not masked by PRIMASK) and yet it did not wake the CPU from STOP2.

I found the solution is to set the RTCAPBAMEN: bit in RCC_SRDAMR (section 11.8.45 in RM0456). There's a macro to do this: `__HAL_RCC_RTCAPB_CLKAM_ENABLE();`. There are corresponding macros for LPUART, I2C3 etc.

If LP peripherals are not waking the CPU from STOP mode check to see if you should be setting bits in RCC !

2 REPLIES 2
Imen.D
ST Employee

Hi @Community member​ ,

Good to hear you made it work and thanks for sharing your solution in our forum, it may be very helpful for Community users.  👍

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
JKahn.1
Associate III

Thanks for sharing, this helped me port from stm32L5 to stm32u5. Was having a really hard time getting a low power timer to wake up the MCU from STOP2 mode

This is my questions: https://community.st.com/s/question/0D53W00002GYwT0SAL/lptim-interrupt-cant-wake-stm32u5-from-stop-low-power-mode