7 years, 9 months ago.

Nucleo-L031K6 LowPower mode

Hello everyone,

I am using the Nucleo STM32L031k6 with mbed and I am looking for low energy consumption. Can someone indicate me an example for putting the microcontroller in sleep mode? What command I need to use to wake-up the micro? There is a library for my nucleo board to solve this problem?

Any advices are welcome. Thank you !

1 Answer

7 years, 9 months ago.

sleep(); puts it in sleep mode. deepsleep(); puts it in deepsleep mode. Difference is that first one keeps all peripherals active, generally roughly 50% current savings. Second one only keeps 'passive' peripherals active, such as InterruptIn, generally >99% current savings.

Waking up from deepsleep can be done with InterruptIn for example. WakeUp library might also work for timed waking (I don't know if your device is supported, try it out).

If you use regular sleep you can wake up using any regular interrupt, such as the previous options, but also Serial interrupt, Ticker, etc.

Accepted Answer

Thanks for your reply!! I have tried the functions sleep() and deepsleep(). It's seems to work fine! Only one thing, in deepsleep mode I have the wake-up of the board only when working with InterruptIn. I have tried Ticker and Timeout, but it's doesn't work. Can I use RTC or WDG to exit from deepsleep mode? Do you have any example on this?

posted by Massimo D.A. 01 Mar 2017

That is correct, in deepsleep only unclocked peripherals such as InterruptIn can wake it, or special low power ones, such as the RTC. As I wrote before, have a look at the WakeUp library: https://developer.mbed.org/users/Sissors/code/WakeUp/. While I see I wrote all mbed STM targets, I actually know a few are not supported. But it uses the RTC to wake from deepsleep mode.

posted by Erik - 02 Mar 2017