Error is as follows

esptool.py v3.0-devSerial port COM10Connecting...Traceback (most recent call last):File "esptool.py", line 3682, in <module>File "esptool.py", line 3675, in _mainFile "esptool.py", line 3330, in mainFile "esptool.py", line 512, in connectFile "esptool.py", line 492, in _connect_attemptFile "esptool.py", line 431, in syncFile "esptool.py", line 369, in commandFile "esptool.py", line 332, in writeFile "site-packages\serial\serialwin32.py", line 323, in writeserial.serialutil.SerialTimeoutException: Write timeoutFailed to execute script esptoolAn error occurred while uploading the sketch

I also change many port but still gave the same error.I also give the additional board manager URL "https://dl.espressif.com/dl/package_esp32_index.json"I use multiple codes but give the same error, so it is unnecessary to attach the code. by the way, the code is in the C language.

3

Best Answer


I had problems uploading code which turned out to be the cable; about the first four or so cables I tried didn't work. I guess it pushes the specs to the limit and cheaper USB cables can't cope. I've now found a cable that works, and have no problems anymore.

I tried everything else first, different ports, different computers, and it was quite surprising that even different cables didn't work, until I finally happened to use one that worked.

So try all your USB cables before giving up. And then go and buy a better cable, just to make sure!

Your error can be caused by a few different things.

USB Cable Check: Let's start by giving your USB cable a quick once-over. Some cables are designed only for charging and don't transfer data. To check if your cable is up for the task, here's a simple test:

  1. Connect your ESP32 board to your computer using the USB cable.
  2. Download and install a terminal program like PuTTY or Tera Term.
  3. Open the terminal program and choose the serial port that your ESP32 is connected to (you can find this info in Device Manager on Windows).
  4. Set the baud rate (communication speed) to the same rate you use for programming (usually 115200).
  5. Now, hit the "Connect" button, then the "reset" button on the board and see if you get any output. If you're seeing readable text, your cable is likely good to go. But if you're getting a bunch of random characters, it might may be the baud rate (speed) that is wrong. If you don't see anything the port/cable is probably bad

Choosing the Right Port: It's important to make sure you're using the correct port for uploading. If you were not sure to find it in the last step, try using the Arduino IDE to upload some basic code to your board. The Arduino IDE will show you all available serial ports, making it easier to find the one that works for your ESP32.

Getting into Flash Mode: If you can read from the board but can't upload to it, it might not be in the right mode. You can sort this out by pressing the "flash" button (if your board has one) while plugging it into the USB port. This gets your board into flash mode, making it ready for uploads.

Press the Boot button while your code is uploading.Most esp32s have two small black buttons on either side of the the usb cable input.

One is labled "boot" and the other "en".to fix the problem Press the Boot button for 3 seconds while your code is uploading.That should work.

Another solution could be to if you are using the arduino ide.After selecting the esp32 board that you will be using.open the tools menu/bar and enable "Erase all flash before skecth upload".

Hope this helps!