Multiple Write Timeout error on XIAO ESP32C3, code stuck after working for a while

Hi every one.

is your esp32C3 XIAO working for a substantial amont of time ?

the error :

esptool.py v4.5.1
Serial port COM8
Connecting...

A serial exception error occurred: Write timeout
Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
*** [upload] Error 1

Description
I have tried 3 boards so far. esp32C3 Xiao boards. And faced the same problem everytime.
the boards works fine for a while, and after xx time suddenly, it’s not possible to upload new code (see error below write time error), the board is stuck (no code running anymore) and it’s not possible to reset nor put the board in bootloader mode to use espRFtool to reflash firmware…

On some board the problem occured after more than 30 working hours, and on others after not even an hour.

when USB cable is connected I can hear the typical sound from windows driver recognized, and I can see the COM port defined in Device manager.

What I have tried so far

according to documentation seedStudio_documentation :

  • I tried to reset the board with reset button (while plugged in) (I use tweezers to push buttons)
  • I tried holding Boot button then reset the board with the reset button
  • I tried holding Boot button and then plugging USB cable (bootloading mode)
  • I tried different USB cables (no USB hubs)
  • I tried upload code with both PlatformIO and Arduino IDE (even try a simple led blinker)
  • I tried to reflash the bootloader with factory firmware without success ( I followed the procedure from here

EspRFTestTool Reflash firmware ERROR write timeout

DEBUG:open com8 sucess
DEBUG:select test bin
DEBUG:Flash
DEBUG:['C:/Users/myuser/Downloads/ESP32-C3_RFTest_108_2b9b157_20211014.bin']
DEBUG:Com is closed ser0
DEBUG:close com sucessfully
ERROR:Write timeout
WARNING:Sync fail...

( I tried with both 115200 and 9600 baudrate)
so for now nothing worked for me.

The really anoying thing is not that one board is stucked, but more that I have tried 3 of them. and all got stucked at some point.

I used an Oscilloscope to see the Power Voltage, when plugging the battery (trough a DC-DC converter) to look after any transient voltage that may be too big for the 3.3V board, but it seems that no peak voltage appeared.

So I have unanswered questions that I ask to myself, and to kind smart people like you.

Is there a way to save these boards ?
What is the cause of that problem ? how could I prevent it to occur in the futur

Perhaps the following steps may help.

  1. Is “USB JTAG/serial debug unit” listed under “Universal Serial Bus Devices” in the Device Manager?
    Note: not “Ports (COM & LPT)”.
  2. If not, this method does not work.
  3. If so, right click “USB JTAG/serial debug unit” and “Update Driver”
  4. select “Browse my computer for drivers”
  5. select “Let me pick from a list of available drivers on my computer”
  6. select “USB Serial Device” and click “Next”

If you are lucky, it will be restored.

Hi msfujino,

Thanks a lot for your message and great idea.

Actually it worked to resolve the Write timeout for me. I tried on one board (I currently only have acess to 1 stucked board).

I was able to reconnect to the board (platformIO, and upload code correctly, and run it again. This is unexpected to me, because I thought the problem was on the board.

for others, here I gather all other possible solutions based on related topics:

Thanks again @msfujino for providing your answer !

The remaining question is what cause a board to get stuck after some hours running ?
Is there anything to check, or do to prevent from happening ?

Hi there,
The code? If the hardware is not defective it’s all it can be, Which BSP are you using? what timers and Interrupts are you using.
Post the code you are running we can LQQK. :v:
HTH

GL :slight_smile: PJ

Hello, I think I have similar problems 2 XIAO ESP32C3 boards worked ok sometime, but then this happened: when uploading they don’t go to bootloader mode automatically.
However doing this, when USB cable plugged: hold boot button down, press and release reset button, bootloader mode is on. I can upload the code (PlatformIO, esptool) normally then doing the reset. If now connect the Lipo battery for powering but no USB the prog runs as expected.
However if I plug USB cable, the board starts rebooting continuously, I can see this in serial monitor. I get sometimes few lines from Serial.print statements, but then crash.
This makes it very difficult to debug the prog. What is going on here ?

Hi there,
Same applies here, Post the code using the code tags above “</>”
paste it in there.
We can comment and show where you went astray.
:v:
HTH
GL :slight_smile: PJ

The code is irrelevant here, this simple code:

int n=0;
void setup() {
   Serial.begin(115200);

  while (!Serial && millis() < 5000)
  {
    // wait for USB serial to connect or 5 seconds to elapse
  } 
  Serial.println("setup done");
  }
void loop() {
Serial.print(n++);
Serial.println(" I am looping");
delay(1000);
}

Produces serial monitor output:
setup done
0 I am looping
1 I am looping
2 I am looping
3 I am looping
4 I am looping
5 I am looping
6 I am looping
7 I am looping
8 I am looping
9 I am looping
10 I am looping
11 I am looping
12 I am looping
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x42014a90
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x90c
load:0x403ce710,len:0x2624
entry 0x403cc710
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)

and C3 keeps rebooting

Hi there,
I would say check the cable. and which BSP you are using.
Roll it back to 2.0.17 and go again…
HTH
GL :slight_smile: PJ
:v:

The cable is ok, because other boards behave normally.
What do you mean, what is BSP ?
I tried to reload with ESPRFTestTool binfile ESP32-C3_RFTEST_V116_4cfb81d_20230922.bin
but the result is the same, keeps rebooting.

Hi there
Are you using Arduino IDE?
If so it’s under the boards tab see which you are using.
HTH
GL :slight_smile: PJ :v:

I am using PlatformIO +vscode for development, and prog “Coolterm” as serial monitor.
I downloaded Arduino IDE, I am not using it, but it actually resolved my problem temporarily:
Using Arduino IDE 2.3.2 serial monitor C3 print debug info as expected and C3 is not rebooting !
So I am confused what is the difference between Coolterm and Arduino Serial Monitor ?
Coolterm works with any other board, anyway my prob solved !

Hi there,

FYI , coolterm settings can make the DTR and RTS do different things, and may make the Xiao reboot and appear to be in a boot loop.
The arduino puts those RTS/CTS & DSR/DTR in better states that doesn’t effect the boot.
HTH
GL :slight_smile: PJ

just setting it for hardware flow control can give those type of issues. :v: