[riot-notifications] [RIOT-OS/RIOT] cpu/stm32l4: add STOP and STANDBY low-power modes (#11173)

Alexandre Abadie notifications at github.com
Thu Mar 14 09:10:54 CET 2019

aabadie commented on this pull request.

I tested this PR on nucleo-f091rc and STOP mode works although consumption see quite high (~2mA instead of 7 in normal run mode). By default, the STANDBY mode doesn't work because all wakeup pins are enabled which causes troubles.

This is why I don't like the current default behaviour with wake-up pins. See my comment below.

> + */
+#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
+static inline uint32_t _ewup_config(void)
+    uint32_t tmp = 0;
+    tmp |= PM_EWUP_CONFIG;
+#elif defined(PWR_CSR_EWUP)
+    tmp |= PWR_CSR_EWUP;

I think this should be done differently.
In the current state, if the user doesn't provide a define for `PW_EWUP_CONFIG`, then this function will activate all wake-up pins.
This results in an invalid default STANDBY configuration for most of the nucleo boards in this case. For example, on nucleo-f091rc, with this default configuration, the STANDBY mode doesn't work unless one builds the application with `CFLAGS=-DPM_EWUP_CONFIG=0`.

What about having the possibility to provide the `PM_EWUP_CONFIG` in the board `periph_conf.h` and include this file in `pm.c` ?
Then there's no need for this function, just use the following snippet in the STANDBY case, below:
And provide a default PM_EWUP_CONFIG to 0 somewhere in the `periph_cpu_common.h` file.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190314/6a267914/attachment.html>

More information about the notifications mailing list