cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to make an L031 wake up in 65 µs - how?

jcw
Associate II

I've been trying to get an STM32L031 to periodically wakeup with minimal power consumption. The specs say it can standby at under 0.5 µA, which I can confirm, but also that it can wake up within 65 µs, which I cannot reproduce. I'm seeing a 1.6 ms delay with 300..400 µA current consumption. This seems to indicate that the µC is waiting for Vrefint to stabilise, even though I have the FWU bit set. Below is a minimal example which still does not wake up in 65 µs:

#include <jee.h>
 
int main() {
    MMIO32(Periph::iwdg+0x00) = 0x5555; // unlock PR
    MMIO32(Periph::iwdg+0x04) = 1;      // max timeout is 800ms
    MMIO32(Periph::iwdg+0x00) = 0xCCCC; // start watchdog
 
    constexpr uint32_t scr = 0xE000ED10;
    MMIO32(scr) |= (1<<2); // set SLEEPDEEP
 
    MMIO32(Periph::rcc+0x38) |= (1<<28); // PWREN
    MMIO32(Periph::pwr) |= (1<<10) | (1<<9) | (1<<1); // FWU, ULP, PDDS
 
    __asm("wfi");
}

I changed the option byte to disable BOR, but it did not make a difference. My write-up about this issue can be found here: https://jeelabs.org/2018/low-power-l031/

What am I missing?

23 REPLIES 23
jcw
Associate II

Yes, that's next on my list, but I need to solve BOTH cases: 1) first power-up with minimal energy (now confirmed in the 65..85 µs range), and THEN after some app config, 2) enter STOP mode for its faster wake-up and its ability to resume in the code iso of having to start from scratch with C startup, etc. And 8 µs startup plus the fact that the code resumes where it left off makes STOP mode very useful.

But as I said, I also need to get through the initial startup with minimal power.

jcw
Associate II

Yes, 2.1 MHz MSI is the default startup clock. Yes, HSI will run faster, but also draw more current. In the end, most energy consumption in a µC is dynamic, i.e. based on number of logic transitions, and whether you deal with them quickly or slowly is less important.

As I mentioned in another reply (bit spread out over this thread, sorry), my main goal is neither current (amps), nor time (seconds), but the product of those (Coulombs), i.e. getting to application code while having consumed the minimum amount of energy.

jcw
Associate II

Just to clarify - I'm using the standby/wakeup tests for understanding what it takes to come alive from (nearly) fully off. Standby is almost the same as powered off, in terms of what the µC has to do to enter run state. Ultimately, I hope to power-on, do minor init stuff, enter stop mode, use the RTC w/ LSI for periodic wake-up, go back to stop mode, etc.

jcw
Associate II

And (sorry for the reply flood - last one) the reason for all this, is that total power in this project will often be insufficient (it's harvested). So full startup from power-down AND periodic wakeup through RTC can both happen fairly often. The µC must be able to handle both situations reliably and predictably.