Getting lower power consumption on Seeed XIAO nRF52840

Thanks for you advice regarding the CR2032! I’ll keep an eye on it! I always disconnect the battery before connecting it to USB. Now, regarding the remaining digital pins, I cycled through them as you suggested. I did it without deep sleep by using pinMode(,INPUT_PULLUP) because I found that this is already sufficient to increase the current from around 5µA to above 30µA (it is a 2 or 3 µA variation day to day). It was only D2 that caused the current to increase. I tried it with a Li ion 18650 cell as well as the CR2032. The current is a bit higher with the Li ion cell (actually consistent with the higher cell voltage), but with both batteries the current increased by about 30µA with pinMode(D2,INPUT_PULLUP). I made this simple sketch to rule out a mistake in the timing of taking the current reading.

//----------------------------------------------------------------------------------------------
// 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;

void setup()
{
  pinMode(LED_RED, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  pinMode(LED_BLUE, OUTPUT);
  digitalWrite(LED_BLUE, HIGH);
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, HIGH);

  // 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(10000);

  while(true) {
    digitalWrite(LED_BLUE, LOW);
    delay(500);
    digitalWrite(LED_BLUE, HIGH);
    pinMode(D2, INPUT_PULLUP);
    delay(5000);
    pinMode(D2, INPUT);
  
    digitalWrite(LED_RED, LOW);
    delay(500);
    digitalWrite(LED_RED, HIGH);
    pinMode(D3, INPUT_PULLUP);
    delay(5000);
    pinMode(D3, INPUT);
  }
}

void loop()
{
  // nothing to do
}


@msfujino from your comment here on

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

can I conclude that I could also use not only D3, but also D0, D1 and D4 to wake up? Any special considerations. I don’t know where I got this from, but I have in mind that only D2 and D3 can be used for interrupts. I have three buttons and it would be nice if any of them would wake up the device from deep sleep, but I could live with just D3 (if it works without immediate restart, which I’ll try next)