7 years, 5 months ago.

Has anybody successfully used the Wakeup library with STM L0 processors?

Hi guys, Having successfully used Erik Oliman's Wakeup library with STM Nucleos, with L1 and also L4 mcus to run a particular program, I have tried running essentially the same program on a Nucleo-L073RZ (and another board using this same processor), which results in some pretty strange behaviour.

The program appears to hang in a call to Wakeup::set(SLEEP_TIME_IN_SECONDS); If SLEEP_TIME_IN_SECONDS is set to 0 it continues (but won't wake from deep sleep). If I add statements to Wakeup::set() that aren't even executed it apparently impacts the behaviour of other parts of the program! So quite similar behaviour to a 'memory overwrite', where the code footprint can change behaviour of a program.

So I was wanting to know whether anybody has successfully used Wakeup, as is, with an L0 mcu or more specifically an STM32L073? Or if you have had to make any changes to the library what are they? Or indeed any other ideas on possible causes of the apparently strange behaviour. Cheers, Ron.

FYI since I don't have an L0 series myself (or any other L series) it has never been tested by me on those devices. I know on a few it won't even compile since they have a completely different RTC, but apparently that is not the case for you.

You can try setting the RTC (set_time function), waiting a second, and then trying the set function. I know there is in the STM set code a quite random delay implemented when the RTC is disabled on start which I never figured out why it was required. Besides that I can't think of many reasons that can give random behaviour without having the target myself.

posted by Erik - 22 Nov 2016

Thanks Erik, really appreciate your getting back on this. So I'll try your suggestion re delay. It's entirely possible of course that the weird behaviour has nothing to do with Wakeup and that the hang there is a side effect of something else.

For example I tried inserting RTC->WPR = 0xFF; return; immediately after the if (ms == 0) {} statement, which should logically result in exactly the same behaviour as setting the time to 0. However the program then never even got to execute Wakeup::set !

posted by Ron Segal 22 Nov 2016

Hi Erik, I tried your suggestion, calling set_time(0); wait(1); then WakeUp::set(SECONDS); but it's still hanging somewhere in WakeUp::set_ms() . So will try to find out exactly where its hanging.

posted by Ron Segal 23 Nov 2016
Be the first to answer this question.