XIAO_ESP32C3: No serial data received

my script is:

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println(“Foo”);
}

void loop() {
Serial.println(“Bar”);
}

And when uploaded I get:

esptool.py v4.2.1
Serial port COM13
Connecting…
Chip is ESP32-C3 (revision 4)
Features: Wi-Fi
Crystal is 40MHz
MAC: 34:85:18:03:24:68
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600

A fatal error occurred: No serial data received.
A fatal error occurred: No serial data received.

I had this same issue. It was strange because micropython was already on the device so I could connect with putty and interact with micropython, proof that both the RX/TX lines were working.

I then held down the boot button while plugin, and was able to reflash the device. I think that somehow my code was preventing it from working correctly as after the first time of reflashing, I no longer had to hold down the button to reflash.

Maybe same issue for you, IDK

1 Like

Uploading firmware and MicroPyhton REPL communication uses the USB port, not the UART interface. And you do not neet to push the boot button for firmware uploading because esptool.py switches the board itself to boot mode.
I do not know an answer to the problem of @nefarious. I rarely use the Arduino environment. From the log, the board switches properly to boot loader mode, but then no software is uploaded, Could be a configuration issue with Arduino and the OS.

I have been working with this device for a while without issue and had put it aside for a month. I pull it back out and now I hit this same exact issue. Hold the boot was plugging it in allowed a once time upload but when it was done it failed to reconnect.

Workaround is to set the upload speed to 115200 (default is 921600). This seems to allow normal operation again.

What I suspect has happened is that the serial driver was updated/patched/replaced in Windows causing some incompatibility (a lot of security fixes and patches in the last few weeks from PC maker and Microsoft).

It worked for me here… Thank you

What if someone has used the UART interface?

How to revert it back?

I had the same issue my ESP32-S3 XIAO but i managed to fix that by setting the serial baud rate to 115200 and go to tools>USB CDC on BOOT> Enabled!
Hope it works. Happy hacking :slight_smile:

I am having the same error:

I was successfully able to upload a sketch using the Arduino IDE (2.3.2) running on Windows 11 Home 21H2. The sketch was this off the shelf one from the vendor website:

void setup() {
  Serial.begin(115200);
  pinMode(A0, INPUT);         // ADC
}

void loop() {
  uint32_t Vbatt = 0;
  for(int i = 0; i < 16; i++) {
    Vbatt = Vbatt + analogReadMilliVolts(A0); // ADC with correction   
  }
  float Vbattf = 2 * Vbatt / 16 / 1000.0;     // attenuation ratio 1/2, mV --> V
  Serial.println(Vbattf, 3);
  delay(1000);
}

This sketch ran fine. In fact, it is still running and returning the current voltage across the voltage divider circuit (soldered on as per the instructions there) in the serial monitor.

When I try to upload anything now I get this error:

Sketch uses 217040 bytes (16%) of program storage space. Maximum is 1310720 bytes.
Global variables use 13404 bytes (4%) of dynamic memory, leaving 314276 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM5
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: ec:da:3b:be:74:5c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600

A fatal error occurred: No serial data received.
Failed uploading: uploading error: exit status 2

I tried to flash the chip using Thonny as well. It recognizes the board and also returns the voltage values in the shell. I cannot stop the process though or upload a new script.

This seems irrelevant but this problem occurred after I connected the external antenna. I have since removed it.

I tried all of the suggestions here but to no avail.

Hi stcline,
Try the following items one at a time, in order.

  1. set the board library to 2.0.11
  2. hold down B_SW, click R_SW, and release B_SW
  3. remove the wire to A0

I also tried this on an Ubuntu (23.04) machine running the latest Arduino IDE. I got essentially the same error.

HI there,
Did you do the steps outlined in order?
since your code is currently running. There is two reasons you can’t upload currently IMO, 1 your A0 wire is acting as a strapping pin.(that’s why you need to remove it)
the second is NO-Time!. If your Loop function doesn’t have any delay in it, the xiao has no idle time enough to detect the upload mode signal by the serial port (arduino IDE bounces) the serial flow control signal to indicate an incoming code upload request for bootloader speed, etc.

those are two of the most common issues that prevent upload while code is running, BTW.
Freeze it by manually putting it in BL-Mode, You know how ?
after that it will work and let you upload , be sure to set the board type and port each time regardless what the status line says in the IDE.
HTH
GL :slight_smile: PJ :v:

That worked! I tried those one step at a time. After step 2, I was able to upload to a different board that did not have the voltage divider circuit soldered on. Once I removed the resistors from the A0 pin on the first board, everything worked. That is too bad as I really liked being able to read battery voltage.

I also need to disconnect the USB and reconnect before anything printing to the serial monitor works.

Thanks for the help!

I assume entering BL-Mode means hold down boot, press and release reset, then release boot, correct?

1 Like

See also post 18 below.
I think it can be used if A0–>A2.
If you really want to use A0, there is another trick.
XIAO ESP32C3, unable to upload sketch or re-write bootloader - #18 by msfujino

Indeed :grin: :+1:

should go , your close, you will get it! :v: