-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
- Open the Serial Monitor in the Arduino IDE. | ||
- Set the baud rate to 115200. | ||
- You will see the sketch continuously printing battery information. | ||
Initial author: Sebastian Romero ([email protected]) | ||
*/ | ||
|
||
#include "Arduino_PowerManagement.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,12 @@ | |
- Open the Serial Monitor in the Arduino IDE. | ||
- Set the baud rate to 115200. | ||
- You will see the sketch continuously printing charger state information. | ||
Please note that the Portenta C33 will not charge batteries that do not have an NTC. | ||
Initial authors: | ||
Cristian Dragomir ([email protected]) | ||
Sebastian Romero ([email protected]) | ||
*/ | ||
#include "Arduino_PowerManagement.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/* | ||
Standby Wake From Pin Demo | ||
This sketch demonstrates how you can use the Arduino_PowermManagement library to send a board to standby mode by using a GPIO pin and wake it up from another. | ||
This sketch is universal and worksn on both Portenta C33 and H7. | ||
On the the Portenta C33 you can select any of the supported pins (A0, A1, A2, A3, A4, A5, D4, D7) to wake up the board from standby mode, | ||
but on the Portenta H7 only GPIO0 can be used to wake up the board from standby mode. GPIO0 is available through the High Density Connectors and you need a breakout board to access it. | ||
Requirements: | ||
- Arduino Portenta C33, Arduino Portenta H7 | ||
- Arduino IDE / Arduino CLI | ||
- PowerManagement library (installable from the Arduino Library Manager) | ||
Usage: | ||
- Connect a button to GOTO_SLEEP_PIN and with a pull-up resistor to 3.3V | ||
- Connect a button to pin PORTENTA_C33_WAKEUP_PIN if you are using the Portenta C33 or GPIO0 if you are using a Portenta H7 and with a pull-up resistor to 3.3V | ||
(If you need information about how to wire the buttons check this link: https://docs.arduino.cc/built-in-examples/digital/Button/) | ||
- Upload the provided sketch to the board | ||
- Press the button connected to GOTO_SLEEP_PIN to put the board into standby mode | ||
- Press the button connected to PORTENTA_C33_WAKEUP_PIN or GPIO0 to wake up the board from standby mode | ||
- The LED will blink every second to show that the board is awake when not in standby mode | ||
Initial author: Cristian Dragomir ([email protected]) | ||
*/ | ||
|
||
#include "Arduino.h" | ||
#include "Arduino_PowerManagement.h" | ||
|
@@ -13,7 +35,7 @@ Board board; | |
void setup() { | ||
board = Board(); | ||
board.begin(); | ||
board.setAllPeripheralsPower(true); | ||
board.setAllPeripheralsPower(true); // TODO: Check if this is necessary | ||
|
||
// Allows to use a button to put the device into sleep mode | ||
attachInterrupt(digitalPinToInterrupt(GOTO_SLEEP_PIN), goToSleep, RISING); | ||
|
@@ -26,8 +48,6 @@ void setup() { | |
// On Portenta only pin GPIO0 can be used to wake up the device from sleep mode | ||
board.enableWakeupFromPin(); | ||
#endif | ||
|
||
|
||
|
||
pinMode(LEDB, OUTPUT); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
/* | ||
Standby Wake from RTC Demo for Portenta C33 | ||
This example demonstrates how to wake up the Portenta C33 from standby mode using the included RTC (Real Time Clock). | ||
The device will go to sleep for 1 second and then wake up. When the device is awake you will see the board's blue LED turned on. | ||
Effectively, you will get the same effect as with blink. | ||
On the Portenta C33 with the peripherals turned off you can expect around 60uA of current consumption in standby mode. | ||
The example also turns off the peripherals before going to sleep and turns them back on after waking up. | ||
Usage: | ||
- Make sure you are running the latest version of the Renesas Core | ||
- Select the Portenta C33 board from the Tools menu | ||
- Select the Portenta C33 USB port from the Tools menu | ||
- Upload the code to your Portenta C33 | ||
Initial author: Cristian Dragomir ([email protected]) | ||
*/ | ||
|
||
|
||
#include "Arduino_PowerManagement.h" | ||
#include "RTC.h" | ||
|
@@ -41,7 +58,6 @@ void setup() { | |
} | ||
} | ||
|
||
// board.enableWakeupFromRTC(0, 0, 10, [](){}); // Sleep for 10 seconds | ||
board.enableWakeupFromRTC(0, 0, 10); // Sleep for 10 seconds | ||
|
||
delay(1000); // Keep the board awake for 1 second, so we can se it working | ||
|
47 changes: 16 additions & 31 deletions
47
examples/Standby_WakeFromRTC_H7/Standby_WakeFromRTC_H7.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,20 @@ | ||
/* | ||
Charger Demo | ||
This sketch demonstrates how to use the PowerManagement library enable low power modes on the Arduino Portenta H7. | ||
* In the setup() function, it enters standby mode and waits for a wakeup event from the RTC. | ||
* The loop() functionit is not used in this sketch. | ||
IMPORTANT: Please note that this sketch has to be uploaded to the M4 core too in order to achieve the lowest power consumption. | ||
Requirements: | ||
- Arduino Arduino Portenta H7 | ||
- Arduino IDE | ||
- PowerManagement library (installable from the Arduino Library Manager) | ||
Usage: | ||
1. Connect a battery to the board. | ||
2. Upload the Sketch to the M4 core: | ||
- Open the provided sketch in the Arduino IDE. | ||
- Select your board type and port from the "Tools" menu. | ||
- Select the M4 core from the "Tools" menu. | ||
- Click the "Upload" button to upload the sketch to your board. | ||
3. Upload the Sketch to the M7 core: | ||
- Select the M7 core from the "Tools" menu. | ||
- Click the "Upload" button to upload the sketch to your board. | ||
4. Observer LED behavior: | ||
- The blue LED will turn on when the board is awake. | ||
- The blue LED will turn off when the board goes to sleep. | ||
- The red LED will blink if the board fails to initialize. | ||
Standby Wake from RTC Demo for Portenta H7 | ||
This example demonstrates how to wake up the Portenta H7 from standby mode using the included RTC (Real Time Clock). | ||
The device will go to sleep for 10 second and then stay awake for another 10. When the device is awake you will see the board's blue LED turned on. | ||
Effectively, you will get the same effect as with blink. | ||
On the Portenta H7 with the peripherals turned off you can expect around 300uA of current consumption in standby mode. | ||
The example also turns off the peripherals before going to sleep and turns them back on after waking up. | ||
Usage: | ||
- Make sure you are running the latest version of the Renesas Core | ||
- Select the Portenta H7 board from the Tools men | ||
- Select the Portenta H7 USB port from the Tools menu | ||
- Upload the code to your Portenta H7 | ||
Initial authors: | ||
Cristian Dragomir ([email protected]) | ||
Sebastian Romero ([email protected]) | ||
*/ | ||
|
||
#include "Arduino_PowerManagement.h" | ||
|