Xiao ESP32C3 runns only when connected to PC

Hello everyone,
Yesterday I wanted to run Xiao ESP32C3 on battery for the first time and I came across an interesting problem.
As a reference program I’ve chosen a simple Blink from Arduino.
When the Xiao is connected to a running computer, everything runs fine as expected.
If I disconnect the USB and the Xiao switches to battery, the program stops running, the LED dimms and stays on.
If I subsequently connect the USB again to the computer, the LED starts blinking rapidly, as if it is making up for the time missed since it was disconnected from the USB.

The battery is fine, voltage 4+V (measured on the board on battery pads)
The 3.3V output from the Xiao gives the expected 3.3V (when battery powered)
but GPIO with LED shows voltage drop to about 2.5V

even resetting after disconnecting the USB doesn’t help. The same behavior is if I plug the USB into the wall or if it is connected to a PC that is turned off (same USB - still powered)
USB volatege measured and is between 4,95-5,1V

Does anyone have any idea what could be causing this?
What makes a difference when the pc is on or off?

Are there “while(!Serial);” or “Serial.print();” in the sketch? These require a serial monitor connection.
Are current limiting resistors connected to the LEDs connected to the GPIOs?

My main sketch has a lot of Serial com as I use it for debbuging via Arduino.
In the Blink example are none, but this I’ve tried at the last, so hopfully I didnt mess it up (it was a midnight:)
The signal LED has a 220ohm in the way.
But again, when connected to running PC I measure 3,3V on LED pin, without the running PC it drops to 2,5V.

Could this be caused by serial communication?
Is it possible, that as the Serial comm doesnt run, the LED pin is floating and not defined?
I have to check it out, gonna see in the evening

In setup(), why don’t you first set pinMode(GPIO number, OUTPUT);?

if you try to open a serial.port the code won’t work without a console attached.

Also, if any Problems with starting/running occurs which is usually omitted by the IDE.

Solved →
It was really the serial connection.
I didnt expect, that when it fails, that the program doesnt continiues.
Same as the GPIO without defined pin has still voltage between 0-3,3V.
Always learning and thank you a lot for hint’

Also i dont think you can power the board externally thru the 5 v pin

Also I did not :slight_smile:
I measured voltage on USB-C

But you CAN power the Board by USB-Port