2018-10-30 04:26 AM
The LPTIM1 interrupt is running. But if I use the EnterStopMode function, the controller is not gone at the stop mode (LED1 come directly). If I use the EnterStopMode function the second time, the controller goes into the STOP mode and after few seconds the interupt wake up the controller (LED2 is delayed few seconds). Do I forget flags reset at first?
if (HAL_LPTIM_Counter_Start_IT(&hlptim1, 20000) != HAL_OK)
{
Error_Handler();
}
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* ### - 4 - Enter in Stop mode ########################################### */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED1_ON;
//HAL_Delay(10);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED2_ON;
//HAL_Delay(10);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED3_ON;
2018-10-30 05:45 AM
Hi @AxelMC ,
Could you please precise which STM32 MCU you're using.
Khouloud.
2018-10-30 05:48 AM
Hi, I use the Nucleo Board L053R8 with STM32L053R8T.
2018-10-30 05:52 AM
Each time, if I set the LPTIM1, I have the problem
HAL_LPTIM_Counter_Stop_IT(&hlptim1);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_LPTIM_Counter_Start_IT(&hlptim1, 50000);
one time ---> NO STOP
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
2 time --> STOP !!! ????
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
2018-10-30 06:03 AM
Hi @AxelMC ,
By default the LPTIM peripheral is deactivated in STOP mode. You have to activate it in order to work properly during this mode.
If you're using HAL, below is the instruction that you should call:
__HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() ;
Khouloud.
2018-10-30 06:12 AM
Hi Khouloud,
My probleme is the controller does not stop. If I enter the STOP Mode the second times, he stops and the Timer wake him up.
/* ### - 3 - Start counting in interrupt mode ############################# */
HAL_LPTIM_Counter_Stop_IT(&hlptim1);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
__HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() ;
HAL_LPTIM_Counter_Start_IT(&hlptim1, 50000);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* ### - 4 - Enter in Stop mode ########################################### */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED1_ON; // ---> Failure not STOPPED -- No Wait!!! :face_screaming_in_fear:
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED2_ON; // --> Come back after 10 sec
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
LED3_ON; // --> Come back after 10 sec
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
2018-10-30 06:47 AM
Hi @AxelMC ,
There is an example under STM32CubeL0, it's found under the path below:
STM32Cube_FW_L0_V1.10.0\Projects\STM32L053R8-Nucleo\Examples\PWR\PWR_STOP
Is it working using your HW? Please check it, maybe you're missing something.
Otherwise you may share your C files (main, msp,it) in order to verify if the issue is reproduced from my side.
Khouloud.