Not entirely sure if I am posting n the correct forum, so I apologize in advance if I picked the incorrect one.
I am having problems uploading a sketch to the Arduino Uno from PlatformIO. I can upload from the Arduino IDE without error, 100% of the time.
What is happening with PlatformIO, is that the majority of the time, it gives me an access denied error accessing the com port the Arduino is connected to. Retrying over and over, and eventually it works.
Have tried different cables and USB ports, with no change in the way it works. I have rebooted the computer, as well as reset the Arduino, again with no change.
Resource manager doesn’t show anything using the com port.
When trying to upload the TX light on the Arduino flashes before I get the access denied message.
Here is a short video showing what it is doing.
Any help fixing this would be greatly appreciated, as I like PlatformIO, over the Arduino IDE, and don’t want to have to switch back
Hm, the error message for “Access denied” is rather generic, but mostly because another program (like the [Arduino] serial monitor) is using the COM port, or because some antivirus is blocking access to it.
Also if your Uno board is a clone with a CH340 chip on it, make sure to install the latest drivers.
There are some threads about it with generic solution hints, like
trying different USB cables and ports on the computer
reconnecting the device
rebooting
updating drivers
changing the COM port number of the device in the device manager (here)
kill eventually running avrdude.exe zombie processes hogging the port (here)
temporarily disable additional antivirus software, if installed
Ok, looks like this has fixed the issue. I manually changed the com port allocated to the Uno from COM5 to COM10, and 4 successive attempts to upload a sketch were all successfull.
I really appreciate your help on this. I was getting very frustrated with it
If the problem occurrs again after a restart (or starting some other software), it will be a strong indication though that some program is hogging all available COM ports in the system (and just hasn’t yet caught wind of the COM port number change that you just did), so be wary of that.
You were on point. It has started giving me access denied on Com10 now as well, so back to the drawing board to try to figure out what is holding that port, without showing up in resource manager
-Larry
Also with this and this information I was able to check what program is using my COM port. E.g., if I plug in my Arduino Uno and execute the reg query command in a cmd.exe…
I know my Uno (COM14) is the device handle \Device\USBSER000. Then using Process Explorer per above article I search for programs holding that device handle…
So it doesn’t show anything using the port, and I confirmed that I was getting an access denied error both before and after I took these screenshots.
As for Anti Virus, I am running MalwareBytes paid version on the computer, and it looks like the Ransomware protection may be the culprit. First I turned off all protection, and found that I was able to upload multiple times without issue, then turning the protections back on, one at a time, it still uploaded each time without issue, until I turned on the Ransomware protection. Then it started failing again. Ultimately, I found that I could have everything except ransomware protection turned on and upload fine. It’s only when the Ransomware protection is active that I have the problem. So it looks like you have definitely pointed me in the proper place.
So, now I just need to pour through MalwareBytes and see if I can figure out how to make it leave the com ports alone, while still providing protection against ransomware, if that is even possible
I really appreciate all the help you have been on this issue for me. It is always great to find a community that is willing to help each other out.