Hi all,
it looks like, the Portenta H7 is prepared (HW wise) for lower power modes (MCU supports it, also PMIC on board does). And I saw also Arduino system_clock.c is prepared a bit for two different MCU core clocks possible.
But there is not really an API to use low power modes (how to enter, how to wakeup and come back). Esp., there is not any code to do a "voltage scaling".
Let's start a project to add low power mode API (and functions to bring Portenta H7 into low power consumption mode(s)).
I start this as a project, to come up with API calls. Please join.
What I know and where to start:
- Portenta H7 supports low power modes, e.g. to bring Domains into STOP mode, have wakeup INTs (or events) etc.
- also: the PMIC on board (controlling the voltages) has a pin connection with MCU: so, the PMIC could act on this external trigger signal to lower the voltages (e.g. when MCU has lowered the clock speed, toggle on PMIC to other profile).
What to achieve:
I am thinking about an API to lower the power consumption, but via different steps (modes).
There should be several modes, such as:
- DVS (Dynamic Voltage Scaling):
lower the MCU core frequency and scale the supply voltages down. Here just as one step:
full performance and low performance (slower clock and also lowered voltage)
DOZE mode (but full retention) - Sleep mode:
retain the memory content, but stop the MCU, wait for a wakeup (via WFI) - Deep Sleep mode:
stop the MCU, but stop also Domains, power down, NO retention, also stop the clocks - data in memories will be lost - a very low power mode (but tough to come back)
Some helpful links:
Low Power Modes in STM MCUs
MCU power modes
I want to keep it simple.
First approach to "try":
- lower the MCU clock
- add to lower also the voltages (via PMIC and using the external control/trigger signal)
So, a DVS single step mode
Second approach to "try":
- use WFI instruction and hold the MCU (until next wakeup INT)
- power down not needed Domains before MCU enters WFI, but keep retention (memory content not lost)
Third approach to "try":
- disable domains (no retention, data is lost), stop clocks
- how to start over? How to reload memory content (or re-initialize system)?
Easiest approach to test:
- use RESET to recover from low power mode
- or use an user GPIO pin (like a user button) to power up again (but not for Deep Sleep Mode, better to reset all and start over, for simplification)
The "problem" not addressed here:
what about all the components on board, e.g. WiFi, USB chip, Crypto chip, QSPI?
In order to see a reduction in power consumption, actually all not needed chips should be disabled (or bring to their low power mode). I will not address (yet) this topic, just let's focus on the MCU itself. Maybe, the results in current reduction might not be so dramatic. But we can add anytime later (when implementing the "Deep Sleep Mode").
I try to create sample code here (a demo project) with the intention to have an API for low power modes.