@daCoder Do you know how to adjust the low power in mbed os version. I try System on mode and only can get roughly 700uA, but on the nrf52840 datasheet, it says 3uA. Do you have any experience for that
@Hao_Liu I don’t have experience with the mbed version. I saw ~3uA on both Zephyr and non-mbed Arduino. I expect the process to get low power and the final result should be similar with the mbed version.
This nordic page has general advice on achieving low power: optimizing-power-on-nrf52-designs
You will probably need to do some of the following:
- Put the flash into deep sleep
- Don’t use GPIO interrupts for the baseline measurement (unless you know mbed uses the low power interrupt mechanism)
- Make sure you are not using the UARTs for something such as serial communication
@daCoder Do you already achieve 3 uA in systemOn mode on a non-mbed Arduino? Right now, I can only achieve roughly 260 uA. I am wondering if this value is still too high or is caused by the Mbed library. Do you have any ideas?
@Hao_Liu I recently upgraded the board library to a more recent version, so I retested. Here is the code I ran:
deep_Sleep3.zip (1.2 KB)
I started with my zephyr build which in non-Arduino. I know this hadn’t changed and I measured 2.9 uA during system_on as before.
I then tested the attached arduino code and measured 15.17uA during system_on. This is using the default Arduino interrupt code. Next I replaced WInterrupts.c as described earlier in the post. This time I measured 3.97uA in system_on and 2.1uA in system_off. Not sure were the extra 1uA came from in system_on, but 3.97uA is still good.
Have you tried running the non-embed code that is posted? If not, I suggest running the posted non-embed code and make sure you achieve the same results. This would help rule out measurement issues or HW issues.
I’m using 1.1.3 “Seeed nRF52 Boards”. (I remember having to manually install two missing libraries.)
Adafruit SPI Flash 4.1.3
I run with a PPK2 at 3.0 volts. Sometimes I run with a CR2032 and just use the PPK2 to measure.
I always remove the USB cable and do a complete power removal to make sure the board is truly reset.
DaCoder,
I duplicated your results with your code and the Nrf52840 Sense Chip.
I could’nt find a BSP of 1.1.3 , so I started with 1.1.1 and , verified same results with BSP 1.1.2, through current BSP 1.1.7,
Reset , Blinks Green LED settles to 25uA., a D2 press Lights Blue LED yielding 300uA. a Press D3 Flashes RED LED SLEEPS 2.5uA. NICE!
D2 wakes it up again or D3 for that matter.
Here is the PPK2 snaps.
RESET
IDLE after RESET
D2 PRESS , LED ON
D3 PRESS, Go to SLEEP
SLEEP
HTH
GL PJ
Your code ; ish
#include "Adafruit_SPIFlash.h"
#include <nrf52840.h>
#define DO_WORK_PIN D2
#define SHUTDOWN_PIN D3
Adafruit_FlashTransport_QSPI flashTransport;
SemaphoreHandle_t xSemaphore;
bool gotoSystemOffSleep = false;
int work_LED_status = HIGH;
void setup()
{
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, work_LED_status);
pinMode(DO_WORK_PIN, INPUT_PULLUP_SENSE);
attachInterrupt(digitalPinToInterrupt(DO_WORK_PIN), doWorkISR, FALLING);
pinMode(SHUTDOWN_PIN, INPUT_PULLUP_SENSE);
attachInterrupt(digitalPinToInterrupt(SHUTDOWN_PIN), shutdownISR, FALLING);
//start bluefruit (this also starts the soft device if you don't start the sd then none of your sd_* calls will do anything
//Bluefruit.begin();
QSPIF_sleep();
xSemaphore = xSemaphoreCreateBinary();
// Flash green to see power on, reset, and wake from system_off
digitalWrite(LED_GREEN, LOW);
delay(1000);
digitalWrite(LED_GREEN, HIGH);
delay(1000);
digitalWrite(LED_GREEN, LOW);
delay(1000);
digitalWrite(LED_GREEN, HIGH);
NRF_POWER->DCDCEN = 1;
NRF_POWER->TASKS_LOWPWR = 1;
uint32_t dcdcen = NRF_POWER->DCDCEN;
//uint32_t tasks_lowpwr = NRF_POWER->TASKS_LOWPWR;
//Serial1.print("DCDCEN: 0x");
//Serial1.println(dcdcen, HEX);
//Serial1.print("TASKS_LOWPWR: 0x");
//Serial1.println(tasks_lowpwr, HEX);
}
void doWorkISR()
{
xSemaphoreGive(xSemaphore);
}
void shutdownISR()
{
gotoSystemOffSleep = true;
xSemaphoreGive(xSemaphore);
}
void loop()
{
// FreeRTOS will automatically put the system in system_on sleep mode here
xSemaphoreTake(xSemaphore, portMAX_DELAY);
if (gotoSystemOffSleep)
{
//Flash red to see we are going to system_off sleep mode
digitalWrite(LED_RED, LOW);
delay(1000);
digitalWrite(LED_RED, HIGH);
NRF_POWER->SYSTEMOFF=1; // Execution should not go beyond this
//sd_power_system_off(); // Use this instead if using the soft device
}
// Not going to system off sleep mode, so do work
work_LED_status = !work_LED_status;
digitalWrite(LED_BLUE, work_LED_status);
//Serial.println(" working");
}
void QSPIF_sleep(void)
{
flashTransport.begin();
flashTransport.runCommand(0xB9);
flashTransport.end();
}
compiler output
FQBN: Seeeduino:nrf52:xiaonRF52840Sense
Using board 'xiaonRF52840Sense' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7
Using core 'nRF5' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7
Detecting libraries used...
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.7" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\variants\Seeed_XIAO_nRF52840_Sense C:\Users\Dude\AppData\Local\Temp\arduino\sketches\C626055A8B6A6EDE2DA7C7647AE7119A\sketch\deep_Sleep3.ino.cpp -o nul
Alternatives for Adafruit_SPIFlash.h: [Adafruit [email protected] Adafruit [email protected]]
ResolveLibrary(Adafruit_SPIFlash.h)
-> candidates: [Adafruit [email protected] Adafruit [email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.7" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\variants\Seeed_XIAO_nRF52840_Sense -Id:\Arduino_projects\libraries\Adafruit_SPIFlash\src C:\Users\Dude\AppData\Local\Temp\arduino\sketches\C626055A8B6A6EDE2DA7C7647AE7119A\sketch\deep_Sleep3.ino.cpp -o nul
Alternatives for SPI.h: [[email protected]]
ResolveLibrary(SPI.h)
-> candidates: [[email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.7" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\variants\Seeed_XIAO_nRF52840_Sense -Id:\Arduino_projects\libraries\Adafruit_SPIFlash\src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SPI C:\Users\Dude\AppData\Local\Temp\arduino\sketches\C626055A8B6A6EDE2DA7C7647AE7119A\sketch\deep_Sleep3.ino.cpp -o nul
Alternatives for SdFat.h: [SdFat - Adafruit [email protected] SdFat - Adafruit [email protected]]
ResolveLibrary(SdFat.h)
-> candidates: [SdFat - Adafruit [email protected] SdFat - Adafruit [email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.7" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\variants\Seeed_XIAO_nRF52840_Sense -Id:\Arduino_projects\libraries\Adafruit_SPIFlash\src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SPI -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SdFat\src C:\Users\Dude\AppData\Local\Temp\arduino\sketches\C626055A8B6A6EDE2DA7C7647AE7119A\sketch\deep_Sleep3.ino.cpp -o nul
Using cached library dependencies for file: d:\Arduino_projects\libraries\Adafruit_SPIFlash\src\Adafruit_FlashCache.cpp
Using cached library dependencies for file: d:\Arduino_projects\libraries\Adafruit_SPIFlash\src\Adafruit_SPIFlash.cpp
Alternatives for Adafruit_TinyUSB.h: [Adafruit TinyUSB [email protected] Adafruit TinyUSB [email protected]]
ResolveLibrary(Adafruit_TinyUSB.h)
-> candidates: [Adafruit TinyUSB [email protected] Adafruit TinyUSB [email protected]]
**EDIT...for brevity..**
Zip created at C:\Users\Dude\AppData\Local\Temp\arduino\sketches\C626055A8B6A6EDE2DA7C7647AE7119A/deep_Sleep3.ino.zip
Multiple libraries were found for "Adafruit_SPIFlash.h"
Used: D:\Arduino_projects\libraries\Adafruit_SPIFlash
Not used: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\Adafruit_SPIFlash
Multiple libraries were found for "SdFat.h"
Used: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SdFat
Not used: D:\Arduino_projects\libraries\SdFat_-_Adafruit_Fork
Multiple libraries were found for "Adafruit_TinyUSB.h"
Used: D:\Arduino_projects\libraries\Adafruit_TinyUSB_Library
Not used: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\Adafruit_TinyUSB_Arduino
Using library Adafruit SPIFlash at version 4.3.1 in folder: D:\Arduino_projects\libraries\Adafruit_SPIFlash
Using library SPI at version 1.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SPI
Using library SdFat - Adafruit Fork at version 2.2.1 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.7\libraries\SdFat
Using library Adafruit TinyUSB Library at version 2.2.6 in folder: D:\Arduino_projects\libraries\Adafruit_TinyUSB_Library
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\9-2019q4/bin/arm-none-eabi-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\C626055A8B6A6EDE2DA7C7647AE7119A/deep_Sleep3.ino.elf"
Sketch uses 47548 bytes (5%) of program storage space. Maximum is 811008 bytes.
Global variables use 7544 bytes (3%) of dynamic memory, leaving 230024 bytes for local variables. Maximum is 237568 bytes.
No serial output everything is communicated via LED.
here’s the setup…
Last Edit… LOL
CAN we get this for Mbed? or close?
The estimated value of 2.2uA and the measured value of 2.3uA in my post are almost the same. (3.6V applied from PPK2 to BAT pad)
‘XIAO nRF52840 Battery voltage reading circuit increases sleep current’
Hi Msfujino,
Yes thank you for guiding me down this lower power path, My battery is a 3.85v@450mhA as you see in picture, so the as measured 2.5 uA. almost average is very good.
My main application and device require minimum interaction, albeit a 2-way connection (BLE-CHAR Notify) but the majority of time could be sleeping or low power and mostly monitoring IMU or RTC for INTERRUPTS. As it is now.
Any long periods of Inactivity would switch to low power, until even more inactivity or command to sleep (always with an ability to wake up)
This is very interesting and on the same level as the range possible of the connection discussion.
TY
GL PJ
Hi, hopefully someone can help
I am using the NRF SDK to try and get low power on the Seeed Sense.
What is strange is I have 3 chips on identical boards. Same code, loaded the exact same way
no SoftDevice. One gets as low as 10uA. One is at 64 and one at 145.
I tried wiping the boards with nrfjprog to earase cache and whatever could be sticking around
Any ideas on what could cause differences across the 3 chips ?
Thanks
Hi there,
How will you achieve LOWEST power with No soft Device?
GL PJ
I did a stripped down version without a SD. The 52840 can operate without a SD.
Is there something in the SD for super low power mode ?
I am getting the same behavior with a SD (I use 340)
Hi there,
Yea that’s a FAT SD it has the nimble support I think and some other stuff too.
Why not use the Published Stuff like the BSP 1.1.X and a generic NRF BL with s140 SD
340 isn’t gonna get you there IMO, you turn off the DCDC and flash etc?
What’s the application scenario?
GL PJ
yes to turning off DCDC and flash.
The weird part is identical chimp exact same code is 45uA more
I have reproduced this with one of the NRF power management samples.
Any idea why two chips would behave differently, one consuming 10uA the other 65uA ?
Hi there,
Hmmm, Yea something is off(oe not powered off)
Have you read both images, with say the NRf_desktop Programer app
post a picture of the map, Like this? Do a read first.
Do both if you can?
HTH
GL PJ
Ok, thanks for your help. Some progress
I did all the screen shots. Nifty to get the version of silicon in the top right. I couldn’t find that anywhere so actually wrote code to do it. To see if maybe I had two batches of chips. They were identical
I even download nfrjprg to wipe out any cache, non volatile memory…grasping at straws
I did all my screenshots and then decided to look at the schematic and go through all the ports.
I was “disconnecting” most of the ports but I was not touch 4 of them used by the Flash. As soon as I disconnected 24 QSPI_SIO1 boom, both chips fell to 2.5uA.
I may be on my way …
I will continue, but any questions that could be useful to others, more than happy to share.
Thanks again. Your questions sent me down a path
Hi there,
Outstanding, Nice tracking that down. Glad to provide some extra POV.
Very NICE, 2.5uA YOWSA!!!
GL PJ
Hi mate! I’m thinking about buying also a Nordic PPKII.
Could you please provide further insights on how exactly did you connect the XIAO to the PPK in order to measure current? I was trying to measure with a KEITHLEY Electrometer in series with a USB-C cable whose Vcc was cut (as in the video @daCoder introduced earlier), but either my USB-C is weird (only 3-wires, I guess ground is in the shield I could kind of messed up when I cut everything) or I’m doing it wrong as I’m running your codes with non-mbed
board version and only reading as min as 2 mA…
Thanks a lot!
Hi there,
Sure,
The PPKII comes with some wires to connect it in two possible ways, One the PPKII provides power to the battery pads on the bottom of the Xiao’s DUT(device under test) This is adjustable also with a slider to select the Exact Voltage for testing different levels. (source power)Amber lit LED.
Second Method and probably the most usable and flexible is to (sync power) Blue lit LED and like an AMP meter in-line with the device allowing a battery to be the Source Voltage and monitor the current running through the PPKII . hence showing the current draw of the DUT. awake or sleeping.
This allows testing diferent battery types and sizes.
NOTE: You must use the Battery +/- PADS on the bottom ALWAYS
I use the little jst connector with flying leads soldered to the pads, See the pictures for more.
It the PPKII and the Nordic BLE Dongle are one of the most used test kits fo rme to date.
the extra’s too are nice , a built in logic analyser of sorts is useful for monitoring the state of other pins while debugging and testing effects of hardware changes on program operation and power consumption. The PPKII is $99 and a VERY good investment. The Dongle is $9 and is invaluable for testing BLE connections and code debugging in real time. Add in some other abilities like a BLE Sniffer and is compatible with wireshark.
I love Nordic devices , because they build the TOOLS first then the Devices, not the other way around as many companies do. There Dev boards are almost too powerful for tinkerer’s but Fit like a glove for a developer. They update there software and maintain a HIGHER level of support than any in the space, Including Expressif who just cranks out the same tired basic ESP32 stuff with only some being low power in real use cases. Nordic is the leader in LOW power, has been for a while.
There N54L Series triples the cpu speed and cutting in half the power requirements. BLE they rule the world with the MOST BLE devices in the world today.
that’s my rant and take on it .
HTH
GL PJ
seeed needs to get with the program and refresh it’s Nrf offering the 52840 is 2 generations behind so…
my hope is they (Nordic) release there soc that has WiFi and BLE on the same silicon.
i need to get one of those power profilers…
Thanks a lot! I will get the two dongles then
Therefore, red and black jumper cables to the bottom of XIAO go to +/- BATT pads, right? But then the red probe connector with the black jumper is supposed to be GND from the bottom of XIAO as well?
And the ammeter is within the PPKII itself and measures the current drawn by XIAO as you mentioned. This last part I got it, I just wanted to make sure about the connections.
Thanks again!
Ht there,
The red test hook is from the logic analyzer function to look at the state of the pin I was testing for output.
Normally not connected unless your looking at signals separate from monitoring the Battery and sleep current.
Yes, PLUS(+) and MINUS(-) from battery pads are all you need. the other is the advanced course…LOL
HTH
GL PJ
there’s a small diagram on the PPK as to which to use for what…