File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
libraries/SrcWrapper/src/stm32 Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -223,12 +223,24 @@ void LowPower_stop(serial_t *obj)
223223 HAL_PWREx_EnableFastWakeUp ();
224224#endif
225225#ifdef __HAL_RCC_WAKEUPSTOP_CLK_CONFIG
226- /* Select HSI as system clock source after Wake Up from Stop mode */
226+ /* Select MSI or HSI as system clock source after Wake Up from Stop mode */
227+ #ifdef RCC_STOP_WAKEUPCLOCK_MSI
228+ __HAL_RCC_WAKEUPSTOP_CLK_CONFIG (RCC_STOP_WAKEUPCLOCK_MSI );
229+ #else
227230 __HAL_RCC_WAKEUPSTOP_CLK_CONFIG (RCC_STOP_WAKEUPCLOCK_HSI );
231+ #endif
228232#endif
229233
230234 /* Enter Stop mode */
231- HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
235+ #if defined(STM32L4xx )
236+ if ((WakeUpUart == NULL ) || (WakeUpUart -> Instance == (USART_TypeDef * )LPUART1_BASE )) {
237+ // STM32L4xx supports STOP2 mode which halves consumption
238+ HAL_PWREx_EnterSTOP2Mode (PWR_STOPENTRY_WFI );
239+ } else
240+ #endif
241+ {
242+ HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
243+ }
232244
233245 /* Exit Stop mode reset clocks */
234246 SystemClock_ConfigFromStop ();
You can’t perform that action at this time.
0 commit comments