ESP32 Error: A serial exception error occurred [Solved]

Sketch uses 230833 bytes (17%) of program storage space. Maximum is 1310720 bytes. Global variables use 20968 bytes (6%) of dynamic memory, leaving 306712 bytes for local variables. Maximum is 327680 bytes. esptool.py v4.5.1 Serial port COM4 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 Failed uploading: uploading error: exit status 1

Numerous reasons could cause this ESP32 error. However, the most suspected cause is driver issues.

Frequent driver issues

Drivers required for ESP32 might not get installed automatically with the Arduino IDE. Open the device manager (Start menu->Search->Device manager) and check whether you have your development board detected under the Ports (COM & LPT) section

There are 2 COM ports in the following example. None of these correspond to development boards, Those are some other devices. Hence, try uploading your code to these may only cause errors.

If your system correctly detects your ESP32, the device manager should have a Port similar to this.

Selecting a non-microcontroller COM port which is Inaccessible

Mistakenly selecting a COM Port that isn’t an ESP32 and inaccessible will show this kind of error message

Sketch uses 237125 bytes (18%) of program storage space.
Maximum is 1310720 bytes.
Global variables use 21048 bytes (6%) of dynamic memory, leaving 306632 bytes for local variables. Maximum is 327680 bytes. 

esptool.py v4.5.1
Serial port COM3

A fatal error occurred: Could not open COM3, the port doesn't exist
Failed uploading: uploading error: exit status 2

Sketch uses 237125 bytes (18%) of program storage space.
Maximum is 1310720 bytes.
Global variables use 21048 bytes (6%) of dynamic memory, leaving 306632 bytes for local variables. Maximum is 327680 bytes. 

esptool.py v4.5.1
Serial port COM3

A fatal error occurred: Could not open COM3, the port doesn't exist
Failed uploading: uploading error: exit status 2
ESP32 Error on selecting a non-microcontroller COM port which is Inaccessible

Selecting a non-microcontroller COM port which is Inaccessible

Accidentally, selecting a COM Port that isn’t an ESP32 will show this kind of error message

Sketch uses 230833 bytes (17%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20968 bytes (6%) of dynamic memory, leaving 306712 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM4
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
Failed uploading: uploading error: exit status 1
Sketch uses 230833 bytes (17%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20968 bytes (6%) of dynamic memory, leaving 306712 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM4
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
Failed uploading: uploading error: exit status 1
ESP32 error selecting a non-microcontroller COM port which is Inaccessible

ESP32 Error Solution

The error is likely because the drivers are missing. Therefore, Install the drivers manually using one of the links below (as specified in this Espressif documentation page)

Installing the CP210x driver fixed the ESP32 error for me.

After installing the drivers, restart your Arduino IDE. Though, it’s preferable to restart your PC.

A new COM port for your ESP32 will be displayed in the port section of your IDE. Then, select the correct COM port and Upload your code.

Select the correct COM port (might be a different number in your case)

Once you select the correct port, another window will open. Then, you’ll have to select the type of your ESP32 board from there. If you are not sure about the board type, physically inspect the ESP32 board to see any labels. If your board is not present on this list, you can select the generic ESP32-XX Dev Module.

Use the search option to find your ESP32 board model

In my case, the board type was DOIT ESP32 DEVKIT V1. Once you get this done, you’ll be able to upload your program to your ESP32 board.

Testing

You can use the following code to test whether your ESP32 Error has been fixed and the board is working as expected. This will make the built-in LED (Not the red power indicator) located on GPIO 2 blink.

/*
https://pcgenerals.com/
PC Generals
ESP32 LED Blink

ON Board LED is on GPIO pin 2
*/

#define LED 2

void setup() {
  // Set pin mode
  pinMode(LED,OUTPUT);
}

void loop() {
  delay(500);
  digitalWrite(LED,HIGH);
  delay(500);
  digitalWrite(LED,LOW);
}

Leave a Reply

Your email address will not be published. Required fields are marked *