XIAO_ESP32C3 Serial.print() excution time depend on serial monitor ON/OFF

There is a large difference in the execution time of Serial.print() depending on whether the serial monitor is turned on/off, and I cannot find the cause. You can check it in the following sketch.
Turn on the LED for 10mS for the execution time of Serial.print() + visibility of the LED. When the serial monitor is on, ON 10mS/OFF 100mS is repeated, but when the serial monitor is off, the execution time of Serial.print() becomes 400mS and ON 400mS/OFF 100mS is repeated.
Can this phenomenon be reproduced?
I need help.

void setup() {
  Serial.begin(115200); 
  pinMode(D10, OUTPUT); // LED 
}

void loop() {
  digitalWrite(D10, HIGH);        // LED ON  
  Serial.println("serial print"); // print to serial monitor
  delay(10);                      // 10mS For LED visibility
  digitalWrite(D10, LOW);         // LED OFF

  // if serial monitor off, LED blink long time(about 400mS)
  // if serial monitor on, LED blink short time(about 10mS) 
  
  delay(100);                     // OFF 100mS and loop
}

seasons Greetings @ms, Have you tried
changing the Baud Rate, may yield a different result.
have you tried 9600 ?
is it different using millis instead?
definitely strange behavior.
GL :slight_smile:

Hi PJ_Glasso,
Of course I have tried 9600 and timers using millis() instead of delay() to no avail. I only have one XIAO_ESP32C3 so I can’t confirm if there is a problem with my board. If it is possible, I would appreciate if someone could try it.

I try it, and Yes it does blink faster or slower Video
HTH
GL :slight_smile:

Thanks for trying it.
I found a site that discusses the same issue, it seems to be specific to the ESP32C3. I am reading the comments now.
If I find out anything I will post it.

I added “Serial.setTxTimeoutMs(0);” according to the comments in the link below and that solved the problem.
ESP32C3M1: Serial.print() calls when not connected to USB cause delays. · Issue #6983 · espressif/arduino-esp32 · GitHub

This is a real thing

i began working with a XIOA and GPS program that was originally built with a
XIAO SAMD i got a XIAO ESP32C3 and was trying to send the GPS thru wifi
and noticed lots of lag and problems and differences between the activity of the
serial connection between the boards