Driver Error Connecting to QT Py ESP32

When uploading the following nearly-blank sketch to my ESP32, there is an error I cannot figure out the cause of.


void setup() { Serial.begin(115200); }

void loop() { Serial.println("Hello World!"); }

// End of sketch
Sketch uses 287285 bytes (19%) of program storage space. Maximum is 1441792 bytes.
Global variables use 30744 bytes (9%) of dynamic memory, leaving 296936 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM9

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

This error is very confusing to me, because the serial monitor successfully connects to the ESP32 though COM9 Please help me fix this issue so that I can upload to my ESP32.

Yes, the correct board is selected, and the port COM9 has been opened for the ESP.

As mentioned, the serial monitor successfully connects through COM9 to the ESP32 and prints IMU sensor data. This eliminates a faulty cable as the cause of the issue.

The embedded system is an Adafruit QT Py ESP32 on a breadboard connected to a MicroSD Breakout Board, a BNO085 9-DOF IMU, and a BMP390 Pressure and Altitude Sensor.

The installed board manager is esp32 by Espressif. The docs say to download these drivers (1)(2). I am running Arduino IDE 2.3.2 on an x64 Windows 11 laptop, and as such installed the "Universal Windows Driver v11.4.0" (1) and the "Windows Desktop Setup Executable" (2).

Here is the message Windows gives when trying to install driver (1) through Device Manager -> Actions -> Add drivers:

Here is the finished installation of driver (2):

After both installations and a restart, the drivers are not visible in device manager. This is why I believe the drivers to be the source of the issue, but I have no idea how to fix them.

Thank you in advance for your help solving this problem.

Hi @tfninjadoom.

It is quite a confusing error. The obvious interpretation is that the COM9 serial port is no longer present on your computer (as would happen if you disconnected the USB cable of the ESP32 board from your computer before attempting an upload), and indeed the error will occur under those conditions. However, you have proven that the port does exist on your computer so we know that is not the cause of the upload failure.

The less intuitive cause of this error message is that the port is present on your computer, but the esptool upload tool is not able to open the port because some other process already has it open (only one process can have control over a serial port at a time). When uploading to other boards, this condition produces a more intuitive error message (e.g., "Access is denied"), but for some reason when uploading to an ESP32 board it instead produces the misleading "the port doesn't exist" error message.


Given my hypothesis that the error is being caused by some other process having COM9 open, we are left with the question of what that process might be. Do you have any other applications running that might have the serial port open? For example, do you have a Python script running on your computer that reads from the serial port? Or maybe you have an external serial terminal program similar to Arduino IDE Serial Monitor running? If so, make sure to either exit those applications, or else close the serial port in the application if supported before attempting an upload.


Since you mention using Arduino IDE Serial Monitor, we might suspect it is the culprit. However, unlike an external application, the integration of Serial Monitor in Arduino IDE allows the IDE to automagically juggle the control of the port between Serial Monitor and the upload process. The IDE closes the port in Serial Monitor when starting an upload and then reopens the port in Serial Monitor after the upload finishes. So we don't expect Serial Monitor to cause this error (at least not when uploading to the QT Py ESP32-S3 board). So I suspect some cause other than Serial Monitor, but it is worth manually closing Serial Monitor and then attempting an upload just to be certain. You can do that by clicking the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window to close the tab:

image

Arduino IDE has similar automagical port handling with its Serial Plotter feature, but just to be safe, it is worth trying an upload after closing the Serial Plotter window in case you are using that feature.

Thank you for your comprehensive answer!

Closing the Serial Monitor, sadly, results in the same error as when it was previously open.

To find applications that use the same serial port (COM9), I followed this tutorial that uses Process Explorer. After finding the "Service" property, searching using that property found 0 applications on my computer using the port.


If I did anything wrong, do not hesitate to let me know!

EDIT: Haha, I spelled usbser as usbuser. I'm running another search in Process Manager with the correct ID.

EDIT 2: Unfortunately, I got the same result. :frowning:

That is unfortunate. Nice work on finding that "Process Explorer" technique! That is definitely a useful tool for troubleshooting this type of problem, even though it didn't yield any answers this time.

Restart your computer and then try uploading again. In some rare cases, a port can get stuck in an unusable state. If this happens, restarting the computer will restore it to normal functionality and allow the upload tool to open the port.