Skip to main content
coffeeMaker
Associate II
May 28, 2021
Question

Does ST confirm the LpTimer issue with stop mode?

  • May 28, 2021
  • 4 replies
  • 1763 views

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.

This topic has been closed for replies.

4 replies

Bubbles
ST Employee
May 28, 2021

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.
coffeeMaker
Associate II
May 31, 2021

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 ??:

0693W00000BZd9GQAT.png 

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

Bubbles
ST Employee
May 31, 2021

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.
coffeeMaker
Associate II
June 1, 2021

hello @JHOUD​ 

Maybe I did not mention before that our FW works but it crashes sometimes and remains stuck exactly at this line :

  1. while(LL_LPTIM_IsActiveFlag_CMPOK(LPTIM1)==0)

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,