I recently got a new computer downloaded arduino IDE 1.8.19, but am having trouble uploading sketches to my existing board. Everything compiles fine but when I go to upload a sketch I get the error shown below. I have successfully uploaded maybe 4 or 5 out of 200+ attempts, but I am not sure how it could be successful even once if there is a problem?
Sketch uses 526137 bytes (40%) of program storage space. Maximum is 1310720 bytes.
Global variables use 25092 bytes (7%) of dynamic memory, leaving 302588 bytes for local variables. Maximum is 327680 bytes.
Traceback (most recent call last):
esptool.py v3.1
File "esptool.py", line 4582, in <module>
Serial port COM3
File "esptool.py", line 4575, in _main
File "esptool.py", line 4074, in main
File "esptool.py", line 120, in get_default_connected_device
File "esptool.py", line 313, in __init__
File "serial\__init__.py", line 90, in serial_for_url
File "serial\serialwin32.py", line 64, in open
serial.serialutil.SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)
[1212] Failed to execute script esptool
the selected serial port [1212] Failed to execute script esptool
does not exist or your board is not connected
run the Windows device manager and have a look at the COM ports - this should give you some idea what ports are connected and if operational or have problems, e.g. drivers not available
I prefer you to change the port u are using
Secondly check for the cable is it ok I mean to say that make sure there should not any cut in between in the cable that can be major issue of your problem
Thirdly run the Windows device manager does it catching your device or not check for the port u are using If you are unable to see your Board in Device Manager then it is problem of your board or of your cable
This does sometimes do the trick every now and then. Also I checked the device manager and I can always see the UART bridge chip so that's good, even when I can't connect. What I've found through more trial and error is my sketch has serial comms to another device through the TXD0 and RXD0 lines, and if I try to connect while this sketch is running this is when I have issues. This is the main sketch that I run with the board though, but there is a period of ESP deep sleep so I wait for that and upload my code.
Use a good quality data USB cable to connect the board to the computer without anything connected or wired to the board. Do not use USB 3.0 port or USB hub.
Make sure you select the board and the port it is connected to before uploading a sketch.
Compile and upload Blink LED example from the IDE examples.
Thanks guys it seems after trying a multitude of these things I have a consistent good connection, I can't narrow it down to just one thing. But as I mentioned a big thing for me was making sure other serial connections weren't active and connecting to the board at these times... Once I got a single good connection to the board I could continue to upload new sketches even while the main UART port was active.