XIAO BLE Sense in deep sleep mode

Unless I’m missing the point of your question, it’s working as is, from post
https://forum.seeedstudio.com/t/xiao-ble-sense-in-deep-sleep-mode/263477/120?u=pj_glasso above.
uses the TAPs to wake it up.
HTH
GL :slight_smile:

Hello there.
May I ask how you turned off that Charge LED?

Hi there, Yea, No one has figured it out yet AFAIK. which ain’t much :grin:
HTH
GL
:wink:

2 Likes

Still not have been able to make the lowpower mode to work properly after reading all this thread… I can make the deepsleep work. I can assign a pin to wake from deepsleep, but it do a full system reset…

But I need the system to wakeup automatically at interval ( like every minutes to report then go back to sleep). So I need not a total sleep, but just lowering the power at max.

I can have a timer generate periodic interrupt. But if I use sd_app_evt_wait, the system don’t stop, it just keep like there was no instruction.


#include <Arduino.h>
#include <Adafruit_TinyUSB.h> // for Serial
#include <bluefruit.h>
#include "Arduino_nRF5x_lowPower.h"
// These define's must be placed at the beginning before #include "NRF52TimerInterrupt.h"
// _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
// Don't define TIMER_INTERRUPT_DEBUG > 2. Only for special ISR debugging only. Can hang the system.
#define TIMER_INTERRUPT_DEBUG         0
#define _TIMERINTERRUPT_LOGLEVEL_     3
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "NRF52TimerInterrupt.h"

#define WAKE_LOW_PIN  D0
// here I have handler for interrpupt... not present because it work fine....


void loop() {

    // setup your wake-up pins.
    pinMode(WAKE_LOW_PIN,  INPUT_PULLUP_SENSE);    // this pin (WAKE_LOW_PIN) is pulled up and wakes up the feather when externally connected to ground.
            
    digitalWrite(LED_BLUE, HIGH);          // just turn the blue led to show that i'M sleep mode

    sd_power_mode_set(POWER_MODE_LOW_POWER);
    Serial.print(millis());   // print the time to see if when I get bac
    __WFE();   // I suppose this is to enable event  for wake up
    __WFI();    // I suppose this is to enable interruption for wake up
    delay(2000);    // from comment I have seen on that thread, need to put a delay here
   
    sd_app_evt_wait();            // Here the system should go in standby , but does'nt
    //NRF_POWER->SYSTEMOFF = 1;   // If a put this active, the process stop, and will restart on pin activation, but the timer seem to freeze, When it restart, jump to reset
    digitalWrite(LED_BLUE, LOW);    // this should turn off the blue led telling me the programm has reach this point, but the led never go off immediately with sd_app_evt_wait, and never with SYSTEM OFF

`Texte préformaté`

Have You checked this issue ?

There doesn’t seem to be a way to shut off the 3v3 voltage regulator as it comes from a separate IC U6 and not the DCDC of the chip, according to the schematic. Charging characteristics of XIAO_nRF52840 and XIAO_ESP32C3 - Products & Technology / XIAO - Seeed Forum (seeedstudio.com)

If some of your peripherals draw less than 15mA, I can suggest connecting the ground and other pins of that peripheral to digital pins, and then setting the digital pins to HIGH right before deep sleep. Elsewhere it is suggested that “The max GPIO sink/source current is 15 mA. This is max both from one pin or as the total for all the pins (entire package).”

I was able to remove most of the quiescent current from a connected Neopixel by doing this, going from above 200uA to around 40uA in deep sleep.

Hi,

Di you measured what current is drained out of the sleep mode?
I get 4.1µA when the LED is off with this code:

#include "Adafruit_SPIFlash.h"


Adafruit_FlashTransport_QSPI flashTransport;

void QSPIF_sleep(void)
{
  flashTransport.begin();
  flashTransport.runCommand(0xB9);
  flashTransport.end();  
}

void setup() {
  digitalWrite(LED_GREEN, 1);
  QSPIF_sleep();
}

void loop() {

  digitalWrite(LED_GREEN, 0);
  delay(500);
  digitalWrite(LED_GREEN, 1);
  delay(5000);
}

Note: In my setup the device is powered by a 3V CR3220 connected on the 3V3 pin

Since the example code claims 3µA in “deep sleep”, I don’t know if it worth to struggle with this for 1µA. Especially considering that Nordic documentation states that going out of System OFF resets the device.

I tried the same code here on my XIAO BLE board, but measure 250uA when LED off.

A few comments/questions:

  • Which board definition were you using?
  • I tried the “Adafruit ItsyBitsy nRF52840 Express” and “Adafruit Feather nRF52840 Express”
  • Compiler didn’t like LED_GREEN, wonder how you found that?
  • I tried to power both via the 3v3 pin and via the bat+ pin

Well,
I don’t know about the board definitions you’re speaking about, I just selected “Seeed Xiao nRF52840” from the board selector. Notice that I don’t have the “Sense” model (there is no IMU on my board).
image

Hello, could you please share an example or some hints on how to wake up the xiao ble after the deep sleep mode with the suggested RESET or RTC? Is it possible to reset the board from code or program an alarm to wake up?

Many thanks in advance!

Hi jimmy, XIAO Nrf52840 BLE Sense unit.

checkout the sleep portion, I use the double tap to wake up (reset) Just be sure to put in the delay before the sleep function. Otherwise it sleeps and wakes right back up in seconds.
HTH
GL :slight_smile:

1 Like

Thank you very much for your answer. I tried your code on the post, and it works perfectly to wake up the device (Reset) with the IMU sensor. However, I am trying to do the same with a timer instead of the IMU.

For a better explanation, I want to:

Turn on the device → read and send a measurement (do something) → go to deep sleep → wake up after 10s (for example) → Repeat (reset).

Based on your experience, do you think this is possible with this board and the available libraries/configurations?

Thanks again for your help!

23µA when the LED is off.
However, if you turn the QSPIFlash Off, I measured 4.2µA like with my script.

2 Likes

in short …so far I learned that :

  • in deep sleep (power off) You can not wake up the device using timer .
  • in power on sleep ( sd_app_evt_wait() ) You can use timers to wake up the device

… The only way to wake up the nRF is with one of a few specific external wakeup signals (GPIO, LPCOMP, NFC or pin reset). A wakeup from system off is always in form of a reset…

1 Like

Thank you, Adam. You are right, it is not possible to use the time in “deep sleep” mode. However, using the "sd_app_evt_wait() " function, I could achieve a low power consumption, which is very suitable for my application.

Thank you very much for the contributions!

Jimmy ,
Yes I wanted also to use a timer, would be preferred. However NOT available to or in both Board versions and weather or not the BLE and IMU function properly with sd_power_mode_set(NRF_POWER_MODE_LOWPWR); functions AFAIK, other views are welcome.
I’m pretty sure that’s why SEEED Licensing put the RTC on the expansion board. RTC interrupt WAY more reliable. and there original If you want to call it “engineering” choices where the wrong ones. Mbed, no mbed either way it’s “HALF” a loaf. just like the battery reading shenanigans’ :smile:
On my board I added the RTC just to overcome and enhance the capabilities.


Rev 2.0 board all mostly SMD parts, NO RTC (found out about NO low power support with BLE and IMU, or reliable battery reading.

Rev 3.1 with RTC , Serial1 port and a display interface connector and a buzzer.

HTH
GL :slight_smile:

1 Like

wow ! looks great :slight_smile:

Do You know any other nrf52840 boards that are “full” like yours ? … and can support proper system-on sleep with BLE use ?

Reading your post I understand that I will not get proper system-on sleep during BLE using ?
Maybe it is a matter of what kind of system-on sleep I will use … thete are a few options of the mode :

I published a sketch and a rewritten arduino interrupt module under this topic Getting lower power consumption on Seeed XIAO nRF52840. The sketch demonstrates an arduino loop() that operates at 3uA with gpio interrupts and no delay() calls using system_on sleep mode. It also demonstrates system_off and wake from system off.

1 Like

is this board for “xiao nrf52840” on the market ?

this one?