Skip to main content
STayl.7
Associate
December 14, 2022
Question

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

  • December 14, 2022
  • 2 replies
  • 1814 views

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 !

This topic has been closed for replies.

2 replies

ST Technical Moderator
December 19, 2022

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.  :thumbs_up:

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
JKahn.1
Associate III
May 17, 2023

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