GitHub hosted

Bring STM32 device into Standby mode and wake it from RTC (Mbed OS 5 library)

Download repository: zip

Standby / wake from RTC on STM32 - library for Mbed OS 5

For low-power applications you often want to bring your microcontroller into the deepest sleep mode possible, and then wake it up from an interrupt or from the RTC. For some reason I couldn’t find any working code samples to do an RTC wakeup in Mbed OS 5. This library fixes this. Originally written by Jammu Kekkonen.

Note that going into standby mode on STM32 will clear all state. Your application will start from the beginning after waking up. If you don’t want this, use sleep mode. This is supported natively by Mbed OS 5 - see the Sleep Manager API.


  1. Add this library to your Mbed OS 5 project:

    $ mbed add

  2. Use this library:


    include “mbed.h”

    include “stm32_standby.h”

    int main() {
    // this is required!

    printf("Hello world, going to sleep for 5 seconds\n");
    // after 5 seconds the application will run from the beginning again