STM32L031K6 LowPowerTicker stops after around 72 minutes

31 May 2018

Dear all,

Currently I am using the LowPowerTicker to tick my STM32L031K6 MCU. However, the ticker froze after around 72 minutes from reset. So I use the same code but replace the LowPowerTicker with Ticker and it works fine (tested for 3 hours).

In fact, I have come across same issue with Ticker when I first used Mbed in 2014. It is because a variable was overflowed after 72 minutes and was not handled properly. The same issue on Ticker was addressed in the next released mbed library.

I believe this issue on LowPowerTicker is the same as that on Ticker. A variable was overflowed but not handled properly.

Hope such issue can be addressed in the near future.

Thanks a lot.

01 Jun 2018

Hi, i'm facing the same issue with my STM32L073RZ NUCLEO board is there a workaround for solving this?

07 Jun 2018

I used InterruptIn to wake up my MCU instead of LowPowerTicker, and it works fine.

08 Jun 2018

Quote:

Hi, i'm facing the same issue with my STM32L073RZ NUCLEO board is there a workaround for solving this?

If you could use LowPowerTimeout instead of LowPowerTicker, you may try this. Note that I am using mbed-lib revision 159 (not release version).

include the mbed library with this snippet

#include "mbed.h"

bool time_out = false;
LowPowerTimeout* lp_timeout = new LowPowerTimeout();

void timeoutCallback()
{
    time_out = true;
}

int main()
{
    lp_timeout->attach(&timeoutCallback, 1.0);

    while(1)
    {
        if(time_out)
        {
            time_out = false;
            delete lp_timeout;
            lp_timeout = new LowPowerTimeout();
            lp_timeout->attach(&timeoutCallback, 1.0);
        }

        sleep();
    }
}
12 Jun 2018

Tony YI wrote:

Quote:

Hi, i'm facing the same issue with my STM32L073RZ NUCLEO board is there a workaround for solving this?

If you could use LowPowerTimeout instead of LowPowerTicker, you may try this. Note that I am using mbed-lib revision 159 (not release version).

include the mbed library with this snippet

#include "mbed.h"

bool time_out = false;
LowPowerTimeout* lp_timeout = new LowPowerTimeout();

void timeoutCallback()
{
    time_out = true;
}

int main()
{
    lp_timeout->attach(&timeoutCallback, 1.0);

    while(1)
    {
        if(time_out)
        {
            time_out = false;
            delete lp_timeout;
            lp_timeout = new LowPowerTimeout();
            lp_timeout->attach(&timeoutCallback, 1.0);
        }

        sleep();
    }
}

Hi Tony, thanks for the tip. I tried this but without luck, the LowPowerTimeout still hangs after 72 minutes. In fact i am deleting and creating the object and attaching it every time the callback change the flag. Also, i used mbed-lib revision 159 but did not find any change in it that let me think it can solve the problem.

13 Jun 2018

aurelio remonda wrote:

Tony YI wrote:

Quote:

Hi, i'm facing the same issue with my STM32L073RZ NUCLEO board is there a workaround for solving this?

If you could use LowPowerTimeout instead of LowPowerTicker, you may try this. Note that I am using mbed-lib revision 159 (not release version).

include the mbed library with this snippet

#include "mbed.h"

bool time_out = false;
LowPowerTimeout* lp_timeout = new LowPowerTimeout();

void timeoutCallback()
{
    time_out = true;
}

int main()
{
    lp_timeout->attach(&timeoutCallback, 1.0);

    while(1)
    {
        if(time_out)
        {
            time_out = false;
            delete lp_timeout;
            lp_timeout = new LowPowerTimeout();
            lp_timeout->attach(&timeoutCallback, 1.0);
        }

        sleep();
    }
}

Hi Tony, thanks for the tip. I tried this but without luck, the LowPowerTimeout still hangs after 72 minutes. In fact i am deleting and creating the object and attaching it every time the callback change the flag. Also, i used mbed-lib revision 159 but did not find any change in it that let me think it can solve the problem.

Did you try the above program? My STM32L031K6 works fine for 2 hours. The reason why I used revision 159 is because my custom PCB used PA_9 and PA_10 as serial port, which is no longer available since revision 161.