2021-05-28 01:47 AM
The LPTIMER OF STM32l0(Config BASED ON LSI) can cause the CPU to be temporarily stuck in the LPTIM ISR with no way for the CPU to clear the IRQ.
The bug is well described here with a workaround, can someone from ST confirm this issue, and if there is some documentation that can explain more on how to avoid it?
Many Thanks.
2021-05-28 04:24 AM
Hello coffeeMaker,
I do not think this case is a bug. The LPTIM is stuck in the Stop mode unless the LPTIM is explicitly configured to run in Stop mode.
There is a HAL call to do just that:
__HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() ;
Rgds,
Jarda
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2021-05-30 11:10 PM
Hello JHOUD,
Thanks for your reply, the flag is set by default please see the attachment, even setting the flag in the init function of Lptimer does not change anything, here is my init and preenable function for LpTimer did I miss anything ??:
void initLptimer()
{
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPTIM1);
Clock::EnableLSI();
LL_RCC_SetLPTIMClockSource(LL_RCC_LPTIM1_CLKSOURCE_LSI);
//Enable LPTIM IN SLEEPMODE
SET_BIT(RCC->APB1SMENR, (RCC_APB1SMENR_LPTIM1SMEN));
}
void preEnableLpTimer()
{
LL_LPTIM_Enable(this);
while (LL_LPTIM_IsEnabled(LPTIM1) == 0); // wait until timer is enabled
}
Best,
CoffeeMaker
2021-05-31 06:10 AM
Hello @coffeeMaker ,
I loaded the example LPTIM_Timeout from the cube intoduction package and quickly replaced LSE with LSI in it.
It worked and woke the MCU from Stop mode. Please check that example, it may be the key to your problems solution.
Rgds,
Jarda
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2021-05-31 11:59 PM
hello @JHOUD
Maybe I did not mention before that our FW works but it crashes sometimes and remains stuck exactly at this line :
Basically, the Lptimer is enabled properly otherwise the FW won't work, so I found this issue discussed here Which explain this strange behavior caused by Lptimer with stop mode.
Any other reason could be behind this crash at that point?
Best,