PlatformIO IDE on Windows 10: COM4": Access is denied

I’ve just done a clean install of PlatformIO IDE on windows 10 (just to test, I use Linux my dev machines). Install seems to have gone well, I can open and compile projects within the IDE.

However when I get Access is denied errro when I try and upload. I know how to fix permission errors like this on Linux but I don’t know where to start on windows 10! I’ve tried restarting the machine and several different Arduino boards. I’ve made sure the serial window is closed.

There is also a slight error that the port auto detect does not work unless I run list-serial ports first.

avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.
avrdude done.  Thank you.
scons: *** [upload] Error 1
 [ ERROR ] Took 19.26 seconds

Running IDE V1.4.0, CLI V2.11.2

Is there a chance that another process already has the port open?

I had the exact same problem. I solved it by changing the USB-port.

Had a similar problem, but then with COM3. Sometimes it loads, most of the times not … very frustrating. It seems as if PlatformIO is having some kind of control over some (lower numbered) COM ports, which seem virtually free, but are in fact not really free. The user cannot identify these port reservations (I would appreciate if someone can confirm this). Hard to find solutions on the internet, though I managed to solve it as follows:

  1. In device Manager, under “Ports (COM & LPT)”, right click on the Silicon Labs one
  2. go to “Properties” - “Port Settings” - select “Advanced”
  3. In the “Advanced Settings for COMx”, select a COM port > 10, whioch is free (in my case I selected arbitrarily for COM17)
  4. Click “OK” to close “Advanced Settings” and 2nd time "OK to close “Properties”
  5. In “platformio.ini” add a line 'upload_port = COMx (where x was 17 in my case). To my belief this setting in ‘platformio.ini’ is not a requirement, though it does noet hurt :wink:
  6. Unplug the USB from the PC, re-plug it in and check that the Device Manager is indicating the correct COM port.

This worked for me without any problem up to now. I would be glad however to learn more on this topic and would be greatful to learn why COM3 is not giving the same positive response.