2025-01-15 05:19 AM
Hi everyone,
During developing applications with STM32l476, using HSI16, I choose STOP1 or STOP2 mode to reduce power consumption , and wake up with RTC Alarm.
if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK) {
Error_Handler();
}
HAL_SuspendTick();
HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
//HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
Documentation states that RCC clocks (and most peripherals) are stopped during Stop mode, thus clock re-init is essential for proper wake up.
Do I have to also re-init peripherals used before entering Stop mode ? For example
//Not only
SystemClock_Config();
HAL_ResumeTick();
//But also
HAL_UART_Init(&htim3);
HAL_TIM_Base_Start_IT(&htim16);
...
In the same spirit, do I have to De-Init peripherals before entering Stop mode ?
I have tested both init/DeInit and not, and both ways seem working, but is it safe to leave peripherals "as they were" before sleeping ? Is Init/Deinit for sleep "lost" cycles ?
2025-01-15 05:25 AM
The datasheet should tell whether peripheral configs are retained during the various low-power modes?