FreeRTOS with STM32 and going into STOP mode

And from your list of peripherals, you need only GPIO and comparator to wake you from stop/standby I think you said.

Just my own 2 cents: you won’t regret using stop mode and tickless idle. That combination gives you the best flexibility. The burden of init/de-init is smaller than you might think. There are some design ideas that really help:

  • Implement a low-power driver that knows which peripherals are currently in use at all times
  • Design all application code to register peripheral use with low-power driver.
  • Low-power driver also implements the configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros to use stop mode instead of sleep mode when appropriate
  • Move the tick to LPTIM (not systick) if you want to use stop mode while delays, timeouts, or FreeRTOS timers are active. (You may not need this, not at first anyway.)

These ideas are demonstrated in GitHub - jefftenney/LPTIM-Tick: FreeRTOS Tick/Tickless via LPTIM in case it helps. Note it is written for the 'L4 so watch out for 'L0 differences.

1 Like