STM32WL55 Using LPUART in STOP2 mode with wake-up & clock-switching (HSI-MSI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-26 8:56 AM
Hi,
in my low-power STM32WL55 application I would like to use the LPUART to receive data (no transmission) while the device is in STOP2 mode. I have two questions about this:
- The reference manual states:
"Before entering low-power mode, make sure that no LPUART transfer is ongoing. Checking the BUSY flag cannot ensure that low-power mode is never entered when data reception is ongoing."
Then how do I check for an ongoing data transfer? The external device connected to the LPUART sends data "spontaneously" so I can't control when this happens, there might be a byte arriving just when I'm entering STOP2 mode. What happens if a reception is ongoing when the device enters STOP2 mode? - I would like to use the HSI oscillator for LPUART reception in STOP2 mode (automatically turning it on when needed). But I would also like to use MSI after wake-up in order to get better flexibility for the CPU frequency (achieving frequencies > 16 MHz, or achieving lower power consumption) by setting STOPWUCK=0. However, keeping both HSI and MSI running results in higher power consumption.
Is it possible to switch the LPUARTs clock from HSI to SYSCLK after wake-up from STOP2 (via LPUART1SEL=1), or will this result in dropping incoming bytes? Does this work only when MSI=16 MHz (like HSI)?
Thanks in advance!
- Labels:
-
STM32WL series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-19 2:35 AM - edited ‎2024-12-19 2:36 AM
Hello @Erlkoenig
I suggest you take a look at the configuration of this example and modify the clock after waking up to SysCLK. This should work fine.
Best Regards.
STTwo-32
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-19 3:15 AM
Hi @STTwo-32 ,
thank you very much. "modify the clock after waking up to SysCLK" - will this also work when SysCLK is not 16 MHz? I guess I have to change LPUART_PRESC while switching the LPUART input clock, but how do I do this atomically, without interrupting an ongoing transfer?
Thanks!
