arduinoesp32thonny

Getting: A fatal error occurred: Unable to verify flash chip connection (No serial data received.) - XIAO ESP32C3


I am trying to use the XIAO ESP32C3 board in a project.

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 have tried the suggestions here but have not had any success. Any ideas?


Solution

  • The XIAO forum provided an answer here.

    The short answer is that I needed to remove the voltage divider circuit from the AO pin, revert the ESP32 board library back to 2.0.11 and then use BL mode (described in the other thread).