On my STM32L476RG, my LPTimer does not work when in STOP1 mode.
At startup I do initializations, then go to STOP1 mode. Initializations include setting a wakeup in the RTC and setting the wakeup clock to the MSI clock.
The RTC successfully wakes the MCU.
In the wakeup callback, I do some things then start a LPTIM. Then I go back to STOP1 mode. The LPTIM callback is never called.
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
{
/* ********* Called when time to acquire and store reservoir pressure ******** */
// turn on reservoir level sensor power supply
HAL_GPIO_WritePin(SENSOR_PWR_GPIO_Port, SENSOR_PWR_Pin, SET);
// LPTIM1 is clocked by a 1 Hz pulse supplied by the RTC
// Start 15 minute timer to allow level sensor to stabilize
if (HAL_LPTIM_Counter_Start_IT(&hlptim1, SENSOR_STAB_SECS) != HAL_OK) {
Error_Handler();
}
HAL_GPIO_WritePin(GRN_LED_GPIO_Port, GRN_LED_Pin, SET);
// HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
}It is called if I remove the command to go to STOP1 mode as shown above. Why is this?
