Some notes on low power modes
This commit is contained in:
parent
41690a7198
commit
b470bf4d14
4 changed files with 93 additions and 5 deletions
|
|
@ -69,7 +69,6 @@
|
|||
#ifndef NRF_CLOCK_ENABLED
|
||||
#define NRF_CLOCK_ENABLED 1
|
||||
#endif
|
||||
|
||||
#ifndef CLOCK_CONFIG_LF_SRC
|
||||
#define CLOCK_CONFIG_LF_SRC 0
|
||||
#endif
|
||||
|
|
|
|||
64
code/playground/nrf_sdk/rtc/rtc_gcc_nrf52-32.ld
Normal file
64
code/playground/nrf_sdk/rtc/rtc_gcc_nrf52-32.ld
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x80000
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.mem_section_dummy_ram :
|
||||
{
|
||||
}
|
||||
.log_dynamic_data :
|
||||
{
|
||||
PROVIDE(__start_log_dynamic_data = .);
|
||||
KEEP(*(SORT(.log_dynamic_data*)))
|
||||
PROVIDE(__stop_log_dynamic_data = .);
|
||||
} > RAM
|
||||
.log_filter_data :
|
||||
{
|
||||
PROVIDE(__start_log_filter_data = .);
|
||||
KEEP(*(SORT(.log_filter_data*)))
|
||||
PROVIDE(__stop_log_filter_data = .);
|
||||
} > RAM
|
||||
|
||||
} INSERT AFTER .data;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.mem_section_dummy_rom :
|
||||
{
|
||||
}
|
||||
.log_const_data :
|
||||
{
|
||||
PROVIDE(__start_log_const_data = .);
|
||||
KEEP(*(SORT(.log_const_data*)))
|
||||
PROVIDE(__stop_log_const_data = .);
|
||||
} > FLASH
|
||||
.log_backends :
|
||||
{
|
||||
PROVIDE(__start_log_backends = .);
|
||||
KEEP(*(SORT(.log_backends*)))
|
||||
PROVIDE(__stop_log_backends = .);
|
||||
} > FLASH
|
||||
.nrf_balloc :
|
||||
{
|
||||
PROVIDE(__start_nrf_balloc = .);
|
||||
KEEP(*(.nrf_balloc))
|
||||
PROVIDE(__stop_nrf_balloc = .);
|
||||
} > FLASH
|
||||
|
||||
} INSERT AFTER .text
|
||||
|
||||
|
||||
INCLUDE "nrf_common.ld"
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
#define LED_PIN 3
|
||||
|
||||
// Seconds between RTC COMPARE0 events.
|
||||
#define COMPARE_COUNTERTIME (1UL)
|
||||
#define COMPARE_COUNTERTIME (3UL)
|
||||
|
||||
const nrf_drv_rtc_t rtc = NRF_DRV_RTC_INSTANCE(0);
|
||||
|
||||
|
|
@ -49,7 +49,8 @@ static void rtc_config(void) {
|
|||
nrf_drv_rtc_overflow_disable(&rtc);
|
||||
nrf_drv_rtc_counter_clear(&rtc);
|
||||
|
||||
// Set compare channel to trigger interrupt after COMPARE_COUNTERTIME seconds.
|
||||
// Set compare channel to trigger interrupt after COMPARE_COUNTERTIME
|
||||
// seconds.
|
||||
err_code = nrf_drv_rtc_cc_set(&rtc, 0, COMPARE_COUNTERTIME * 8, true);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
|
|
@ -64,8 +65,8 @@ int main(void) {
|
|||
|
||||
rtc_config();
|
||||
|
||||
// NRF_POWER->SYSTEMOFF = 1;
|
||||
while (true) {
|
||||
// NRF_POWER->SYSTEMOFF = 1;
|
||||
__SEV();
|
||||
__WFE();
|
||||
__WFE();
|
||||
|
|
|
|||
26
resources.md
26
resources.md
|
|
@ -358,4 +358,28 @@ Changing the following on framework-arduinoadafruitnrf52/variants/feather_nrf528
|
|||
- [devzone thread](https://devzone.nordicsemi.com/f/nordic-q-a/12731/clocks-timers-rtc-why):
|
||||
- Timers use the HFCLK; better resolution, more power usage
|
||||
- RTC uses the low frequency source LFCLK; less accurate, less power usage
|
||||
I want RTC, since I don't need to be super precise and I want to save as much battery as possible.
|
||||
I want RTC, since I don't need to be super precise and I want to save as much battery as possible.
|
||||
|
||||
## Power down
|
||||
- [powerdown examples](https://github.com/NordicPlayground/nrf51-powerdown-examples) for nrf51 and nrf52
|
||||
- How to measure current with the dev kit using an oscilloscope. [Docs by nordic](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf52832_dk%2FUG%2Fnrf52_DK%2Fhw_meas_current.html)
|
||||
- Good thread on devzone about current measurement [link](https://devzone.nordicsemi.com/nordic/short-range-guides/b/hardware-and-layout/posts/current-measurement-guide-measuring-current-with-n)
|
||||
|
||||
There is something very weird going on. The current usage of my module varies wildly with the input voltage (Vcc). Something is off:
|
||||
- Vcc = 2.5 => 15uA
|
||||
- Vcc = 3.3V => 1ma
|
||||
- Vcc = 3.6 => > 2ma
|
||||
|
||||
Very weird. What I did:
|
||||
- Tried the same sketch with a barebones nrf52832 module (E73-2G4M04S1B). It seems to behave as expected: around 2uA current in the input range 2V-3.6V;
|
||||
- Soldered _another_ nrf52840 to another breakout board. Now I'm seeing ~4uA in the input range 2V-3.6V;
|
||||
|
||||
This suggestes there was something wrong with my previous nrf52840 module. Maybe I abused it too much or shorted something while soldering (but I wasn't able to find it with a contuniuity test). Also the system on might be because the nrf52840 has more RAM to keep powered on. We can selectively disable some, I think.
|
||||
|
||||
Anyway, I'm considering this solved.
|
||||
|
||||
A side note: the E73-2G4M04S1B module uses the "old" nrf52832 module, but it shows lower current _and_ it has a 32kHz crystal built in, which the E73-..C does not. I think the old module might be a better choice for us. The only downside is that it's slightly larger, but shouldn't matter at all.
|
||||
|
||||
So the latest data is:
|
||||
- System ON sleep: ~4uA
|
||||
- System OFF sleep: 0.3uA (pretty cool!)
|
||||
Loading…
Add table
Reference in a new issue