2018-06-28 04:29 AM
Hi all,
I'm trying low power modes of the STM32. I've noticed that HAL_PWREx_EnterSTOP2Mode synopsis mention that:
* The voltage regulator is set in low-power mode but LPR bit must be cleared to enter stop 2 mode.
* Otherwise, Stop 1 mode is entered.however
/STM32Cube_FW_L4_V1.11.0/Projects/NUCLEO-L476RG/Examples/PWR/PWR_STOP2_RTC/Src/
does not include such thing. and AN4621 indicates that LowPowerRun mode doesn't get involved when switching between Run mode and Stop2 modes.
Therefore I see contradiction. Could any one clarify please ?
Thanks,
2018-06-28 05:47 AM
Hello Mohamed,
LPR is a name of a bit in PWR_CR1 register. You can find its description in MCU's reference manual. I attach extracted content below:
As you can see this bit allows MCU to enter Low-power RUN mode. There is also confirmation that this bit needs to be cleared before entering STOP mode in order to achieve STOP2 instead of STOP1.
The outcome of this description is a message, that STM32L4 MCU can't make a switch from Low-power RUN to STOP2 directly. If application uses Low-power RUN, then it is mandatory to make a switch from Low-power RUN to RUN and then from RUN to STOP2. Please find below a simple diagram, which shows possible transistions in terms of operating modes.
Now regarding the code: this is correct that HAL_PWREx_EnterSTOP2Mode function doesn't clear LPR bit. So this action has to be done by other function, which is HAL_PWREx_DisableLowPowerRunMode. But please note: this function needs to be called before HAL_PWREx_EnterSTOP2Mode
only
when MCU is using low-power RUN mode. Otherwise, if normal RUN mode is used, LPR bit is set to 0 and there is no need to take care about this bit.I hope this information properly answers your question.
Regards
Szymon2019-02-27 02:52 AM
Hello Szymon,
Thank you for you support. This is a useful information.
Regards,