-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32L4: Fix sleep implementation #7813
Conversation
Correctly detect and handle the low power run mode when entering and exiting sleep mode. The generic `hal_sleep` implementation tries to exit LPR mode always, resulting in a spin-loop during a critical section (disabled IRQ). The new approach returns from LPR to Run mode if enabled (LPR bit set), enters sleep, and resets to the original state on wakeup (WFI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your proposal of this improvement.
I have asked 1 question. Also we will run tests before we can merge this patch.
@ARMmbed/team-st-mcd Please review |
Is this patch still up to date, does it need any further edits or approved? |
@MSiglreithmaierRB hi - is there any chance you could update your PR and use HAL interface instead of directly accessing registers ? |
@LMESTM Sry, I didn't see the notification. // power on device ..
UARTSerial uart (TX, RX);
// ..
uart.baud(115200)
uart.write("Hello");
wait_ms(8000); // could be also 1ms, we receive some data over during this call. Spin looping with wait_ms(0) would work in contrast as we don't hit the 'sleep' path there.
uart.read(..); // read out uart, we see that we are missing bytes from the response
// The UART buffer overflowed at higher baud rates. For lower rates we saw less drops I don't have a simple example file to reproduce it atm, unfortunately.
sure, I will update it! |
Pushed the requested change. Please let me know if further changes are required and/or if I'm supposed to squash the commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
@MSiglreithmaierRB |
@LMESTM Thanks for reviewing. |
/morph build |
Build : SUCCESSBuild number : 3202 Triggering tests/morph test |
/morph mbed2-build |
Exporter Build : SUCCESSBuild number : 2794 |
Test : SUCCESSBuild number : 3002 |
The test results are all passed, there is one character in the logs that caused CI to report unstable. |
Description
Correctly detect and handle the low power run mode when entering and exiting sleep mode.
The generic
hal_sleep
implementation tries to exit LPR mode always, resulting in a spin-loop during a critical section (disabled IRQ).The new approach returns from LPR to Run mode if enabled (LPR bit set), enters sleep, and resets to the original state on wakeup (WFI). This follows the specification for the STM32L4.
Pull request type