PlatformIO Community

Could not open port

hello, i have problem with PlatformIO, i tray acces my board Esp32. DO IT ESP DEV KIT v.1

i’m tray to view serial monitor but result is could not open port (acces danied) may be some body can help me…
thanks alot.Capture9

“Access is denied.” normally means that there is already another program using that COM-port. Windows allows only one program at the time to access COM-ports. Do you have a serial monitor opened on that port elsewhere?

I don’t have a serial monitor that is opened on that port anywhere else. even I tried replacing the com port from the advanced settings on the menager device, but the results remained the same, as if the board wasn’t readable, even though the menager device was detected.Capture8

Maybe try to open the port with a different serial monitor? I don’t know any standalone applications for that (you will probably find a bunch if you google) but the one that comes with the Arduino IDE or pyserial for Python.

I’m having the same problem, particularly with M5StickC+ which uses the FTDI driver for the serial connection.
My issue is only with PlatformIO. I can connect to the COM port for the M5 just fine with Putty, Arduino IDE and others. I even verified that Putty would report an error connecting if another application had a hold on it.
I even tested Putty connection right after PIO gave the Access Denied error.
Some of my fixes, like rebooting the PC might work, other times it does not.
I think the Access Denied is a false or misleading error that is being caused by something totally different.

Hello roysinurat.
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.

I’m using Linux Mint. My problem was solved this way. After Serial.begin(115200); I had to add a delay(400); This gives the serial port on the ESP32 a chance to set up. Hope it helps.

After some trial and error I could get it to work.
Changed COM ports as suggested by @yvesdelbrassine, open the serial Monitor and make sure, it opens for the configured COM Port (why does platformio sometimes open the monitor for the wrong port!??)
When you managed to open the correct monitor, PRESS AND HOLD THE RST button on your esp device and THEN CLICK UPLOAD .
Once the terminal tells you it tries to connect,
release the rst button.

I have three esp32 devkit 1. For one of them I needed the hold-rst-trick, but for all three of them I had to make sure the serial monitor opens for the correct COM Port before uploading.