Arduino IDE Unable to Open COM Port

Hello,

I'm running into an incredibly frustratring issue with my Arduino IDE/Arduino Nano. For some reason, whenever I try to upload a sketch to the Nano, I get an error that looks like this:

avrdude: ser_open(): can't open device "\\.\COM205": Access is denied.

I've tried changing the COM port number, restarting my PC, tried multiple PCs and several Arduino Nanos, according to multiple other forum posts who have stated this issue. And I still get this error. It is incredibly frustrating and has halted work on my project.

Any assistance on this issue is greatly appreciated.

Hi @itshipsternoah. Make sure you have selected the port of your Arduino board from the Tools > Port menu in the Arduino IDE. You can verify COM205 really is the board by doing this:

  1. Unplug your Arduino board from the computer.
  2. Select Tools > Port from the Arduino IDE menus.
  3. Note the ports, if any, listed in the menu.
  4. Close the Tools menu.
    The ports list is only updated when the Tools menu is re-opened, so this step is essential.
  5. Plug your Arduino board into the computer.
  6. Select Tools > Port from the Arduino IDE menus. - The new port listed in the menu is the one for your Arduino board.

image_2022-11-02_220301059

Hi @ptillisch,

Thanks for the fast reply! I have verified that the port is indeed COM Port 205. The issue is very intermittent—sometimes the upload will succeed, most of the time it won't.

Wow. I'm not saying that it's a known bug, but maybe things would work better if you went in and something to put your com ports in the single digit range (or is it an intentional naming scheme?) It wouldn't surprise me if there was code somewhere that assumed a com port name couldn't be more than 5 characters, with resulting "random" failures depending on whether the next bytes in memory happened to contain a null or not.

Hi @westfw, I only did this because I thought that perhaps the OS takes lower COM port numbers for other devices and that this causes a conflict.

However, I was able to resolve this issue using the Arduino IDE 1.8.19. I've had several issues with the newer version, 2.0, since its release, I think I'm going to wait to continue using it until it becomes more stable.

I gave it a try. When I attempted to upload after changing the port, I got a different error:

avrdude: ser_open(): can't open device "\\.\COM205": The system cannot find the file specified.

I get the same error when using Arduino IDE 1.8.19, so this is nothing specific to Arduino IDE 2.x.

After I unplugged and then replugged the Nano board, the upload to port 205 worked just fine.

Hi @ptillisch,

That's very strange. On my machine, I can't get it to work with version 2.0. I've tried re-plugging and occasionally got it to work. I'm not sure why 1.8.19 works better, but my current setup works for now.

If you could share any potential causes of this issue, I can try to fix those to continue working with the 2.0 IDE.

Thanks,

Noah

If you would like to do some troubleshooting, you can check whether the low level serial-discovery tool used by the Arduino development software to find ports is behaving and able to see the port of your board.

I'll provide the instructions here:


:exclamation: NOTE: These instructions will not solve the problem. They are only intended to gather more information which might provide a clue that eventually leads to a solution.


During all this, keep an eye out for anything that doesn't match the expected behavior as described at each step.

  1. Open the following folder in Windows "File Explorer":
    C:\Users\<username>\AppData\Local\Arduino15\packages\builtin\tools\serial-discovery
    
    Note that the AppData folder is hidden by default in "File Explorer". You can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
  2. The serial-discovery folder will contain a subfolder for each of the versions of serial-discovery which are installed on your computer.
    For example:
    serial-discovery/
    ├── 1.3.0/
    ├── 1.3.0-rc1/
    └── 1.3.2/
    
  3. Hold the Shift key while clicking the right hand button on the mouse on the folder with the highest version (1.3.2 in the example above).
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open.
  5. Type the following command:
    .\serial-discovery
    
  6. Press the Enter key.
    serial-discovery will now start. There won't be any obvious sign of this other than that there is no longer a command prompt at the cursor in the terminal.
  7. Type the following command:
    HELLO 1 "arduino-cli 0.20.2"
    
  8. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "hello",
      "protocolVersion": 1,
      "message": "OK"
    }
    
  9. Unplug your Arduino board from your computer if you have it plugged in.
  10. Type the following command:
    START_SYNC
    
  11. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "start_sync",
      "message": "OK"
    }
    
    You might also see some additional objects in the output depending on which serial ports are available on your computer.
  12. Plug your Arduino board into your computer.
    You should now see a response printed that looks something like this:
    {
      "eventType": "add",
      "port": {
        "address": "COM42",
        "label": "COM42",
        "protocol": "serial",
        "protocolLabel": "Serial Port (USB)",
        "properties": {
          "pid": "0x804e",
          "vid": "0x2341",
          "serialNumber": "EBEABFD6514D32364E202020FF10181E"
        }
      }
    }
    
    This is only an example of what you might see. The output will be different depending on the board you connected.
  13. Unplug your Arduino board from your computer.
    You should now see a response printed that looks something like this:
    {
      "eventType": "remove",
      "port": {
        "address": "COM42",
        "protocol": "serial"
      }
    }
    
    This is only an example of what you might see. The address field value should be the same as the "add" event you saw when you plugged the board in.

You should continue to see the same results if you repeat steps (12) and (13).

Once you are done with your experiments with the "serial-discovery" tool, follow these instructions to exit:

  1. Type the following command:
    STOP
    
  2. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "stop",
      "message": "OK"
    }
    
  3. Type the following command:
    QUIT
    
  4. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "quit",
      "message": "OK"
    }
    
    You should now be back at the shell command line.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.