Skip to content

Commit 9a0a5c8

Browse files
committed
Add disabling of SWD pins and UART pins to lower by another 1uA.
1 parent bc156fd commit 9a0a5c8

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

libraries/Examples/examples/Advanced/LowPower/LowPower.ino

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
Buy a board from SparkFun! https://www.sparkfun.com/products/15376
1111
1212
How close can we get to 2.7uA in deep sleep?
13-
This example shows how decrease the Artemis current consumption to less than 3uA in deep sleep.
13+
This example shows how decrease the Artemis current consumption to less than ~2.5uA in deep sleep.
1414
15-
Note that Artemis modules with revision A0/A1 silicon will use ~30uA. Please see the
15+
Note that Artemis modules with revision A1 silicon will use ~30uA. Please see the
1616
Ambiq errata for more information: https://www.ambiqmicro.com/static/mcu/files/Apollo3_Blue_Errata_List_v1_0_external_release.pdf
1717
1818
To monitor the current to the Edge cut the MEAS jumper, solder in headers, and attach
@@ -56,6 +56,16 @@ void setup()
5656
// Disable the RTC.
5757
am_hal_rtc_osc_disable();
5858

59+
// Disabling the debugger GPIOs saves about 1.2 uA total:
60+
am_hal_gpio_pinconfig(20 /* SWDCLK */, g_AM_HAL_GPIO_DISABLE);
61+
am_hal_gpio_pinconfig(21 /* SWDIO */, g_AM_HAL_GPIO_DISABLE);
62+
63+
// These two GPIOs are critical: the TX/RX connections between the Artemis module and the CH340S on the Blackboard
64+
// are prone to backfeeding each other. To stop this from happening, we must reconfigure those pins as GPIOs
65+
// and then disable them completely:
66+
am_hal_gpio_pinconfig(48 /* TXO-0 */, g_AM_HAL_GPIO_DISABLE);
67+
am_hal_gpio_pinconfig(49 /* RXI-0 */, g_AM_HAL_GPIO_DISABLE);
68+
5969
// The default Arduino environment runs the System Timer (STIMER) off the 48 MHZ HFRC clock source.
6070
// The HFRC appears to take over 60 uA when it is running, so this is a big source of extra
6171
// current consumption in deep sleep.

libraries/Examples/examples/Advanced/LowPower_WithWake/LowPower_WithWake.ino

+14-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
SparkFun Electronics
55
Date: October 17th, 2019
66
License: This code is public domain. Based on deepsleep_wake.c from Ambiq SDK v2.2.0.
7-
A big thanks to robin_hodgson for pointing out the HFRC shutdown requirement.
7+
A big thanks to robin_hodgson for pointing out the HFRC shutdown requirement and
8+
turning off the SWD pins.
89
910
SparkFun labored with love to create this code. Feel like supporting open source hardware?
1011
Buy a board from SparkFun! https://www.sparkfun.com/products/15376
1112
1213
How close can we get to 2.7uA in deep sleep?
13-
This example shows how decrease the Artemis current consumption to ~4.2uA in deep sleep
14+
This example shows how decrease the Artemis current consumption to ~2.4uA in deep sleep
1415
with a wake up every 5 seconds to blink the LED. The RTC is used to trigger an interrupt
1516
every second.
1617
17-
Note that Artemis modules with revision A0/A1 silicon will use ~30uA. Please see the
18+
Note that Artemis modules with revision A1 silicon will use ~30uA. Please see the
1819
Ambiq errata for more information: https://www.ambiqmicro.com/static/mcu/files/Apollo3_Blue_Errata_List_v1_0_external_release.pdf
1920
2021
To monitor the current to the Edge cut the MEAS jumper, solder in headers, and attach
@@ -48,6 +49,16 @@ void setup()
4849
// Initialize for low power in the power control block
4950
am_hal_pwrctrl_low_power_init();
5051

52+
// Disabling the debugger GPIOs saves about 1.2 uA total:
53+
am_hal_gpio_pinconfig(20 /* SWDCLK */, g_AM_HAL_GPIO_DISABLE);
54+
am_hal_gpio_pinconfig(21 /* SWDIO */, g_AM_HAL_GPIO_DISABLE);
55+
56+
// These two GPIOs are critical: the TX/RX connections between the Artemis module and the CH340S on the Blackboard
57+
// are prone to backfeeding each other. To stop this from happening, we must reconfigure those pins as GPIOs
58+
// and then disable them completely:
59+
am_hal_gpio_pinconfig(48 /* TXO-0 */, g_AM_HAL_GPIO_DISABLE);
60+
am_hal_gpio_pinconfig(49 /* RXI-0 */, g_AM_HAL_GPIO_DISABLE);
61+
5162
// The default Arduino environment runs the System Timer (STIMER) off the 48 MHZ HFRC clock source.
5263
// The HFRC appears to take over 60 uA when it is running, so this is a big source of extra
5364
// current consumption in deep sleep.

0 commit comments

Comments
 (0)