Getting lower power consumption on Seeed XIAO nRF52840

Try this sketch.
You can connect an external 3k3 pull-up or pull-down resistor if needed.
Sleep current is about 2uA when 3.8V is applied to the battery pad.

//----------------------------------------------------------------------------------------------
// BSP : Seeed nRF52 Borads 1.1.8
// Board : Seeed nRF52 Borads / Seeed XIAO nRF52840 Sense 
//----------------------------------------------------------------------------------------------
// 2025/01/15

#include <Adafruit_SPIFlash.h>    // 4.3.4, NOTE:need to deleted /Documents/Arduino/libraries/SdFat
#include <flash_devices.h>

// for flashTransport definition
Adafruit_FlashTransport_QSPI flashTransport;
Adafruit_SPIFlash flash(&flashTransport);
static const SPIFlash_Device_t my_flash_devices[] = {P25Q16H,};
const int flashDevices = 1;

#define PIN_WAKEUP (28)  // D0:(2), D1:(3), D2:(28), D3:(29), D4:(4)

void setup()
{
  // Enable DC-DC converter Mode
  NRF_POWER->DCDCEN = 1;            // Enable DC/DC converter for REG1 stage
  
  // on board Flash enter to Deep Power-Down Mode
  flash.begin(my_flash_devices, flashDevices);
  flashTransport.begin();
  flashTransport.runCommand(0xB9);  // enter deep power-down mode
  delayMicroseconds(5);             // tDP=3uS
  flashTransport.end();

  // Light Sleep Mode (RTOS delay function)
  delay(1000);

//  sd_power_gpregret_set(0, 0x6D); //Set GPREGRET0 to 0x6D (DFU_MAGIC_SKIP)
//  nrf_gpio_cfg_sense_input(PIN_WAKEUP, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);
  nrf_gpio_cfg_sense_input(PIN_WAKEUP, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);

  // Deep Sleep Mode
  NRF_POWER->SYSTEMOFF = 1;
}

void loop()
{
  // nothing to do
}
1 Like