XIAO_ESP32 write to device failure

I am trying to write an image to the Xiao_esp32C3 from the arduino ide. I have been doing the same thing for several weeks. Now I am getting this error message:

Sketch uses 905624 bytes (69%) of program storage space. Maximum is 1310720 bytes.
Global variables use 37180 bytes (11%) of dynamic memory, leaving 290500 bytes for local variables. Maximum is 327680 bytes.
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
Changed.
Configuring flash size…
Flash will be erased from 0x00000000 to 0x00003fff…

Writing at 0x0008000e… (46 %)
Writing at 0x000868e5… (50 %)
Traceback (most recent call last):
File “esptool\loader.py”, line 365, in command
File “esptool\loader.py”, line 317, in write
File “serial\serialwin32.py”, line 325, in write
serial.serialutil.SerialTimeoutException: Write timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “esptool.py”, line 34, in
File “esptool_init_.py”, line 1004, in main
File "esptool_init
.py", line 806, in main
File “esptool\cmds.py”, line 502, in write_flash
File “esptool\loader.py”, line 108, in inner
File “esptool\loader.py”, line 963, in flash_defl_block
File “esptool\loader.py”, line 406, in check_command
File “esptool\loader.py”, line 393, in command
File “serial\serialutil.py”, line 372, in timeout
File “serial\serialwin32.py”, line 222, in _reconfigure_port
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: OSError(22, ‘A device which does not exist was specified.’, None, 433)
[9916] Failed to execute script ‘esptool’ due to unhandled exception!
the selected serial port [9916] Failed to execute script ‘esptool’ due to unhandled exception!
does not exist or your board is not connected

I have unplugged the device and let it sit for a while in case it was just in bad state. No change.

Have tried this several times with no change.

I’ve found that resetting the Windows comms ports helps. Once the port number reaches double digits, the ports don’t work reliably. This is a tutorial for resetting the ports: [HOW TO CLEAR OR RESET COM PORTS? - Soldered Electronics] (HOW TO CLEAR OR RESET COM PORTS? - Soldered Electronics).

Every time you use a new device, another port gets created. I was at port 15 and couldn’t get the device to load without doing the Boot-reset-boot dance and then I had to hit reset to run the program. But after resetting the Windows port, the device got reassigned to port 4 and it was recognized properly and got reset after uploading the code.

Sorry if this is a duplicate response–I haven’t read through all of the posts on this forum. But it’s such a common issue with Windows that it’s worth repeating :slight_smile:

The error message indicates that the write timeout has occurred while attempting to upload the program to the Xiao_esp32C3 board using the esptool.py command line tool. This could be due to a variety of reasons, such as a communication problem between the computer and the board, incorrect wiring, or a damaged board.

Here are some steps you can try to resolve the issue:

Check the wiring: Make sure that the board is connected to the correct port and that the wiring is secure.

Check the serial port: Verify that the correct serial port is selected in the Arduino IDE.

Try a different USB cable: Sometimes, a faulty or damaged USB cable can cause communication errors. Try a different USB cable to see if that resolves the issue.

Restart the board: Disconnect the board from the computer and press the reset button on the board. Reconnect the board to the computer and try to upload the program again.

Regards,
Rachel Gomez