|
4 | 4 | SparkFun Electronics
|
5 | 5 | Date: October 17th, 2019
|
6 | 6 | 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. |
8 | 9 |
|
9 | 10 | SparkFun labored with love to create this code. Feel like supporting open source hardware?
|
10 | 11 | Buy a board from SparkFun! https://www.sparkfun.com/products/15376
|
11 | 12 |
|
12 | 13 | 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 |
14 | 15 | with a wake up every 5 seconds to blink the LED. The RTC is used to trigger an interrupt
|
15 | 16 | every second.
|
16 | 17 |
|
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 |
18 | 19 | Ambiq errata for more information: https://www.ambiqmicro.com/static/mcu/files/Apollo3_Blue_Errata_List_v1_0_external_release.pdf
|
19 | 20 |
|
20 | 21 | To monitor the current to the Edge cut the MEAS jumper, solder in headers, and attach
|
@@ -48,6 +49,16 @@ void setup()
|
48 | 49 | // Initialize for low power in the power control block
|
49 | 50 | am_hal_pwrctrl_low_power_init();
|
50 | 51 |
|
| 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 | + |
51 | 62 | // The default Arduino environment runs the System Timer (STIMER) off the 48 MHZ HFRC clock source.
|
52 | 63 | // The HFRC appears to take over 60 uA when it is running, so this is a big source of extra
|
53 | 64 | // current consumption in deep sleep.
|
|
0 commit comments