Serial ports stack up when plugging in and out the arduino uno

Hey everyone,

i have been messing around with arduino for some time now, but currently i have encountered a problem which i dont know how to solve.
when im prototyping and I want the arduino and sensors, motors and servos to turn of i usually just unplug the usb from my computer. This has worked propperly for quite some time now, however this week when i plug it back in the arduino IDE doesn’t remove the old connection and also shows the new connection. with multiple connections, the IDE doesn’t want to upload with the error code:

avrdude: ser_open(): can’t open device “\.\COM3”: Access is denied.

if i restart Arduino IDE the problem still occurs, it can only be resolved by completly rebooting my laptop.

i tried reinstalling Arduino IDE and using the latest version 1.8.9 but this did not help.

The summing up of the serial port com connections can be seen in this print screen →

Does anybody have a clue on how to resolve this?

Cheers!

Hi janbots,

I had the exact same problem on 1.8.12 just yesterday. Mine was resolved by just rebooting. Since this doesn't seem to do the trick in your case, here are some ideas:

  • Try uninstalling the IDE, then (with the Arduino still plugged in) go to Device Manager (you must be on an admin account for this to work) - Ports, select the Arduino, uninstall the driver and then reinstall the IDE (it automatically reinstalls the driver if the checkbox is ticked)
  • Reprogram the USB translator. This only works if your Arduino is using an ATmega8U or ATmega16U (it should be located near the USB port and the large quartz). Follow this guide if you choose to do this.

Beware that those are just things that could - in my mind - potentially fix the problem. I haven't tested any of them. Use at own discretion.

This topic has been covered a few times.

I refer to it as "creeping com ports"
One of the more common reasons is that a user modifies the COM settings eg. locking a COM port to a device.
That can cause more issues.
Also some boards DO have TWO COM ports with the second often known as the BOOTLOADER.

There are a couple of simple things to try.

  1. Simply restart the computer.

  2. Ensure you dont have any serial or terminal programs running

  3. RESET Windows COM port lists.

Multiple com ports has been reported in a variety of cases both on the forum, github, and directly.
More frequently happens with a Windows environment and is even more common with multiple live boards.

Testing has shown that it is possible for the windows com stack to become unstable after COM 30 but that is more of an edge case.

In some scenarios it may be advisable to reset the COM stack.
Quite a simple process under windows fortunately.

  1. Disconnect as many USB devices as possible.

  2. From an ELEVATED COMMAND PROMPT

  3. Type
    set DEVMGR_SHOW_NONPRESENT_DEVICES=1

  4. Then
    devmgmt.msc

  5. When device manager comes up select the "Show Hidden Devices"

  6. Goto the COM & LPT section (occasionally hidden under windows 10)

  7. Then simply delete all the COM ports with the exception of COM 1 and if it shows up COM 2
    Optional is also to remove drivers at each removal but I have only had to do that on quite rare occasions.

  8. Restart the computer and slowly add each device back.
    Note the port numbers may change from the original ones.

Almost sure I know why it happens with Arduinos in particular but it would probably be a complex fix and I am not that clever.

This helped me: Overview | How to Find Hidden COM Ports | Adafruit Learning System ...a graphical version of screwbob's suggestions...

DaveEvans:
This helped me: Overview | How to Find Hidden COM Ports | Adafruit Learning System ...a graphical version of screwbob's suggestions...

Better than my attempt.
Thanks Davina :grinning:

:slight_smile: