cancel
Showing results for 
Search instead for 
Did you mean: 

Does ST confirm the LpTimer issue with stop mode?

coffeeMaker
Associate II

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.

4 REPLIES 4
Bubbles
ST Employee

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

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

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

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,