High Power Consumption on Xiao nRF52840 Using Pin P0.17 as Input

Hi everyone,

I’m experiencing an issue with my Xiao nRF52840 board, which I’m programming using Arduino (not the mbed-enabled version). I noticed a significant increase in power consumption when I set pin P0.17 as an input to determine whether the battery is charging or not.

Specifically, the power consumption goes up by 400uA when I configure P0.17 as an input pin. This increase is far too high for my application needs.

I want to use an interrupt to detect when the battery is charging but without the added 400uA consumption. Could anyone please explain why this is happening and suggest any solutions or workarounds to mitigate this power increase?

Any advice or insights would be greatly appreciated.

Thank you!

P0_17 is connected to the CHG pin of the charge controller and can detect whether charging is in progress. The CHG terminal is also used to light the green LED that indicates charging is in progress.
Isn’t the increase in current due to the green LED lighting up to indicate charging, rather than because P0_17 is set as an input pin?

Hi,

Thank you for your response. I appreciate your suggestion regarding the green LED.

I have conducted my measurements with only the battery connected to the board, without any external power source or the green LED indicator being active. Despite this, I still observe the increase in current of 400uA when setting P0.17 as an input pin.

if you like it put a resistor on it

I tried it, but the current consumption does not increase even when the P0_17(CHG terminal) is set to input.
Please try this.

#define CHG 23
pinMode(CHG, INPUT_PULLUP);

If the problem persists, there may be a misunderstanding, so please show me your sketch (the whole thing, not just a part of it).

1 Like

This is my code:

#define PIN_CHG 23  // D23 charge indicatore LOW:charge HIGH:no charge

void setup() {
  // put your setup code here, to run once:

}

void loop() {

  delay(5000);
  pinMode(PIN_CHG, INPUT);
  delay(5000);
  pinMode(PIN_CHG, OUTPUT);
}

I tried using INPUT_PULLUP, and there is no extra power consumption:

#define PIN_CHG 23  // D23 charge indicatore LOW:charge HIGH:no charge

void setup() {
  // put your setup code here, to run once:

}

void loop() {

  delay(5000);
  pinMode(PIN_CHG, INPUT_PULLUP);
  delay(5000);
  pinMode(PIN_CHG, OUTPUT);
}

So the trick is to use INPUT_PULLUP instead of INPUT?

It is not clear from the circuit diagram and data sheet why the current decreases when INPUT_PULLUP is selected.

By the way, why is pinMode(PIN_CHG, OUTPUT) used? If the charge controller sets the CHG terminal to LOW, it will cause a problem.