1+ /* *
2+ * This example builds on the Standby Example which puts the microcontroller of the Portenta H7 into
3+ * standby mode for 10 seconds by also turning off most of the peripherals on the board using the PF1550 PMIC.
4+ * This example turns off the following power rails on the PMIC:
5+ * * LDO1 - ANX7625 video bridge
6+ * * LDO2 - onboard misc. chips
7+ * * LDO3 - 1.2V for Ethernet
8+ * * SW1 - Ethernet PHY, SDRAM, USB PHY
9+ * * SW2 - External Power Regulator
10+ *
11+ * Original author: A. Vidstrom (http://arduino.cc)
12+ * Updated by: C. Dragomir (http://arduino.cc)
13+ * This code is in the public domain
14+ */
15+
16+ #define NO_ETHERNET_TURN_OFF
17+
18+ #include " Arduino_LowPowerPortentaH7.h"
19+ #include " Arduino_PMIC.h"
20+ #include " Wire.h"
21+
22+ void setup () {
23+
24+ #if defined CORE_CM7
25+ if (LowPowerReturnCode::success != LowPower.checkOptionBytes ()) {
26+ LowPower.prepareOptionBytes ();
27+ }
28+ bootM4 ();
29+ #endif
30+
31+ pinMode (LEDB, OUTPUT);
32+ digitalWrite (LEDB, LOW);
33+ delay (1000 );
34+
35+ #if defined CORE_CM7
36+ PMIC.begin ();
37+
38+ // Turn off the ANX7625 video bridge
39+ PMIC.getControl () -> turnLDO1Off (Ldo1Mode::Normal);
40+
41+ // Turn off misc onboard chips
42+ PMIC.getControl () -> turnLDO2Off (Ldo2Mode::Normal);
43+
44+ // Turn off the 1.2V for Ethernet
45+ PMIC.getControl () -> turnLDO3Off (Ldo3Mode::Normal);
46+
47+ // Turn off the Ethernet PHY, SDRAM, and USB PHY
48+ PMIC.getControl () -> turnSw1Off (Sw1Mode::Normal);
49+
50+ // Turn off the external power regulator
51+ PMIC.getControl () -> turnSw2Off (Sw2Mode::Normal);
52+
53+ // Turn off the I2C bus as the PMIC might try to communicate with the microcontroller
54+ Wire1.end ();
55+
56+
57+
58+ LowPower.standbyM7 (LowPowerStandbyType::untilPinActivity | LowPowerStandbyType::untilTimeElapsed, 10 s);
59+ //
60+ // The following is an alternative way to go into Standby Mode for 10 seconds:
61+ // LowPower.standbyM7(LowPowerStandbyType::untilTimeElapsed, RTCWakeupDelay(0, 0, 10));
62+ //
63+ // The following is how to go to into Standby Mode waiting only for a wakeup pin:
64+ // LowPower.standbyM7(LowPowerStandbyType::untilPinActivity);
65+ //
66+ #else
67+ LowPower.standbyM4 ();
68+ #endif
69+ }
70+
71+ void loop () {}
0 commit comments