Permission error with esptool.py

deweywsu
Posts: 2
Joined: Tue May 10, 2022 2:43 am

Permission error with esptool.py

Postby deweywsu » Thu May 12, 2022 4:48 am

I'm having problems with a particular computer when trying to flash firmware to an ESP32 built under the Arduino framework from PlatformIO, which uses esptool.py to do that write operation. This is on Windows 10 (x64).

I get the following messages:
[Codebox]
esptool.py v3.1
Merged 1 ELF section
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Use manually specified: COM1
Uploading .pio\build\esp32doit-devkit-v1\firmware.bin
esptool.py v3.1
Serial port COM1
Connecting...
Traceback (most recent call last):
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 435, in command
p = self.read()
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 380, in read
return next(self._slip_reader)
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 3021, in slip_reader
raise FatalError("Timed out waiting for packet %s" % waiting_for)
__main__.FatalError: Timed out waiting for packet header
[/Codebox]
During handling of the above exception, another exception occurred:

[Codebox]Traceback (most recent call last):
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 4582, in <module>
_main()
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 4575, in _main
main()
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 4074, in main
esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 121, in get_default_connected_device
_esp.connect(before, connect_attempts)
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 629, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False, usb_jtag_serial=usb_jtag_serial)
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 596, in _connect_attempt
self.sync()
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 486, in sync
val, _ = self.command(self.ESP_SYNC, b'\x07\x07\x12\x20' + 32 * b'\x55',
File "C:\Users\joshd\.platformio\packages\tool-esptoolpy\esptool.py", line 451, in command
self._port.timeout = saved_timeout
File "C:\Users\joshd\.platformio\penv\lib\site-packages\serial\serialutil.py", line 372, in timeout
self._reconfigure_port()
File "C:\Users\joshd\.platformio\penv\lib\site-packages\serial\serialwin32.py", line 222, in _reconfigure_port
raise SerialException(
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'Access is denied.', None, 5)
*** [upload] Error 1[/Codebox]

My platformio.ini file:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
upload_port = COM1
upload_speed = 115200
monitor_speed = 115200 ;Serial monitor speed

I am using the ESPDEVKIT V1 board and have tried a multitude of things, including re-assigning the serial port, attaching a capacitor between the power and enable line as described here, examining with both the Arduino IDE serial monitor and using the prescribed sequence of boot and enable buttons before trying to program (and trying not pushing them as well). In addition to PlatformIO v5.2.5, I have tried using Arduino IDE version 1.8.19 and Arduino IDE version 2.0.0 rc2, each as an administrator. It fails on all IDEs, so I am led to believe this is some kind of OS issue.

I have tried examining for other applications that have the serial port open using Process Explorer, and found a pre-installed Dell application that had to do with maintenance and removed it. I then tried the same process and found nothing else tying up the port, and also delved into using Windows Performance Analyzer from the Windows SDK. Results were not conclusive because I didn't understand the use of that software well enough. I have tried disabling Windows Defender, my sole antivirus program. I have tried a number of current Silicon Labs drivers for the CP2102 that is on this board, which appears may be counterfeit, but I also tried on a board that appeared to have a genuine CP2102, and go the same results. I had a friend try to program this module with another Windows machine, and he was successful.

What can I do to further understand what it is about this machine that is locking the serial port from esptool.py? Please let me know if there is a more appropriate forum to ask this question.

Thanks

Who is online

Users browsing this forum: No registered users and 62 guests