ESP32 Thing : Cannot connect reliably to download code.

Even though the serial port is working over USB , I cannot reliably connect to download my code from my computer to the ESP32.

I have been fighting this issue ever since I began using the ESP32. I have searched the net considerably for a solution and even posted to this forum previously about this issue. In searching the net, it is obvious that others are having the same issues to the point that one would think that the manufacturer would be addressing the issue.

A typical experience has been that the issue occurs at the start of a debug session. Then a number of techniques, none of which work reliably until it works. Then it will randomly work. The techniques include pressing the reset button before starting the build process and after. Not pressing the reset button. Closing the serial monitor window. Disconnecting the USB cable from the board. Trying different physical USB ports and forcing a change in the comm port, different ESP32’s, and the ever reliable waiting for the moon to change phase. Finally yesterday it stopped loading the code altogether yesterday. I tried for 45 minutes without connecting. Then I tried for another hour or 2 this morning only connecting once.

I really wish that SparkFun would fix this issue. Since I live within a half hour of your building, you can even come over and we can work on it together.

The port is working though. The output of my program is being displayed to the monitor window.

Here is one of the messages that I am getting.

In file included from C:\Users\doncl\Documents\dc_Maker\aProjects\PingPongBallDisplay\PingPongBallDisplay\PingPongBallDisplay.ino:58:0:

C:\Users\doncl\Documents\Arduino\libraries\FastLED-3.4.0\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

pragma message “FastLED version 3.004.000”

^

In file included from C:\Users\doncl\Documents\Arduino\libraries\FastLED-3.4.0\src/FastLED.h:65:0,

from C:\Users\doncl\Documents\dc_Maker\aProjects\PingPongBallDisplay\PingPongBallDisplay\PingPongBallDisplay.ino:58:

C:\Users\doncl\Documents\Arduino\libraries\FastLED-3.4.0\src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message “No hardware SPI pins defined. All SPI access will default to bitbanged output”

^

Sketch uses 669425 bytes (51%) of program storage space. Maximum is 1310720 bytes.

Global variables use 40196 bytes (12%) of dynamic memory, leaving 287484 bytes for local variables. Maximum is 327680 bytes.

esptool.py v3.0-dev

Serial port COM4

Traceback (most recent call last):

File “esptool.py”, line 3682, in

File “esptool.py”, line 3675, in _main

File “esptool.py”, line 3329, in main

File “esptool.py”, line 263, in init

File “site-packages\serial_init_.py”, line 88, in serial_for_url

File “site-packages\serial\serialwin32.py”, line 62, in open

serial.serialutil.SerialException: could not open port ‘COM4’: WindowsError(5, ‘Access is denied.’)

Failed to execute script esptool

the selected serial port Failed to execute script esptool

does not exist or your board is not connected

Here is another error message that I’m getting.

esptool.py v3.0-dev

Serial port COM5

Traceback (most recent call last):

File “esptool.py”, line 3682, in

File “esptool.py”, line 3675, in _main

File “esptool.py”, line 3329, in main

File “esptool.py”, line 263, in init

File “site-packages\serial_init_.py”, line 88, in serial_for_url

File “site-packages\serial\serialwin32.py”, line 62, in open

serial.serialutil.SerialException: could not open port ‘COM5’: WindowsError(5, ‘Access is denied.’)

Failed to execute script esptool

the selected serial port Failed to execute script esptool

does not exist or your board is not connected

processing.app.SerialException: Error opening serial port ‘COM5’.

at processing.app.Serial.(Serial.java:152)

at processing.app.Serial.(Serial.java:82)

at processing.app.SerialMonitor$2.(SerialMonitor.java:132)

at processing.app.SerialMonitor.open(SerialMonitor.java:132)

at processing.app.AbstractMonitor.resume(AbstractMonitor.java:132)

at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2120)

at processing.app.Editor.access$1300(Editor.java:117)

at processing.app.Editor$UploadHandler.run(Editor.java:2089)

at java.lang.Thread.run(Thread.java:748)

Caused by: jssc.SerialPortException: Port name - COM5; Method name - openPort(); Exception type - Port busy.

at jssc.SerialPort.openPort(SerialPort.java:164)

at processing.app.Serial.(Serial.java:141)

… 8 more

Error opening serial port ‘COM5’.

Here’s yet another error.

I noticed this part:

File “site-packages\serial_init_.py”, line 88, in serial_for_url

File “site-packages\serial\serialwin32.py”, line 62, in open

serial.serialutil.SerialException: could not open port ‘COM5’: WindowsError(5, ‘Access is denied.’)

…are you using 32, or 64-bit Windows? Because it looks like that fastLED library is utilizing the wrong serial library…this post here https://stackoverflow.com/questions/356 … it-windows has a method that might work, try following that 1st answer and see how that goes

Is there another program using COM5?

A serial terminal emulator or possibly some GPS software?

If so, close those programs first, then try programming your ESP32.

I had exactly this problem (SerialException / Access is denied error from esptool)

I installed a Serial Port Monitor app from https://serial-port-monitor.org which showed that my MalwareBytes Antimalware was interfering when esptool tried to open the COM port. I turned off Ransomware Protection in MBAM and I stopped getting the Access is denied errors. You may have a different malware product but the Serial Port Monitor app should show what is blocking the COM port access.