Go Down

Topic: Same COM port many times (Read 465 times) previous topic - next topic

MikD

IDE 1.8.9
Win 10 Pro US

Recently I am having issues with the Arduino IDE resulting in seeing the very same COM port number often twice and to a lesser degree up to four times. This despite the Device Manager only having one Arduino Zero COM port listed.

When it happens the uploading fails to finish but sometimes the code is still uploaded. Sometimes I have to unplug and restart the PC before I can proceed. I have tried to reburn the bootloader but in vain.

Double clicking the reset button doesn't help either - as it does when the upload COM port isn't found. But probably this is no surprise because the COM port is seen multiple times.

Why is this?

What can I do to stop this from happening?

It might be that this is something related to 1.8.9 because I can't remember if it has happened before.

TIA
MikD

pert

I don't know why this happens, but I have the same problem with my MKR boards and the issue has been reported a few other times here:

I associate the problem with having the Serial Monitor open when I upload to the board. However, I just did a bunch of uploads using Arduino IDE 1.8.9 while the Serial Monitor was open and the board printing to it and now I can't reproduce the problem. If I could find a set of steps I could follow to reliably reproduce the issue, I could open a bug report with the Arduino developers. I don't really like to do that when I can't provide such a set of steps because it's extremely difficult to investigate and fix a problem if you can't reproduce it. If you manage to find a way to reliably cause this issue, please let me know, or open a bug report.

I've found the workaround for the problem is to close all Arduino IDE windows, unplug the board, then restart the Arduino IDE and plug it in again. That's much less of a hassle than restarting my computer (which is what I was previously using as a workaround).

There is a report of duplicate ports here:
https://github.com/arduino/Arduino/issues/8408#issuecomment-457058375
but that's about network ports, so I don't think it's relevant. However, the pluggable discovery system was introduced in Arduino IDE 1.8.9 so if the problem does not occur in IDE versions prior to 1.8.9, it is possible that some change made with the pluggable discovery system is the culprit.

pert

I managed to find a way to reliably reproduce this issue. The way to do it is to unplug the board while Serial Monitor is open. That does it every time.

I plug my Arduino boards into a USB hub that's seen better days, so it's possible that I sometimes get a momentary loss of USB connectivity if I jiggle the cable or bang my work bench, which could have been causing the same thing to be happening even when I didn't intentionally unplug the cable.

I found that the duplicate Tools > Port menu entries issue didn't occur when using the beta build of the Arduino IDE, but that the spurious upload error still did occur with that IDE version. The issue does not occur with Arduino IDE 1.8.8.

I opened a bug report in the Arduino IDE repository about this:
https://github.com/arduino/Arduino/issues/8851

MikD

Hi pert and the forum

Thanks for getting back to me.

Here is another way to replicate problem:

Open Serial Monitor
Press reset
Close Serial Monitor
Open Serial Monitor

Then one more COM port entry with the same number is visible.

I hope this and your description can help the IDE developers.

Thanks!

pert

Nice one! That's better than my approach.

MikD

I don't know but can this https://www.avdweb.nl/arduino/samd21/virus help in any way in making the Arduino IDE/Zero USB communication and allocation more robust: https://www.avdweb.nl/arduino/samd21/virus

chrisrenson

I am experiencing the duplicate COM  port described above. It happens every time I try to run my sketch, which makes the whole setup virtually unusable. I am new to Arduino, so I don't know how long I should expect to wait for this bug to get fixed. Can anyone tells me what to expect?

Not surprisingly, the Serial.available() test fails in this case, so I can't execute a Serial.read() to get input.

Also, can someone tell me more about the suggestion to use Arduino IDE/Zero USB. What do I need to try? Very frustrated by being dead in the water.

pert

Hi chrisrenson. One of the Arduino developers already made a fix for the issue. It has not yet been released in a production version of the Arduino IDE, but a beta tester version is available here:
https://github.com/arduino/Arduino/pull/8046#issuecomment-509170956

Note that I describe two issues here:
  • Duplicate entries for a port shown on the Tools > Port menu
  • Spurious upload failures

Although these issues are both caused by the same event, the test build I linked above only fixes the second issue. The first issue is merely cosmetic and is fixed in the Arduino IDE beta build. So both issues have been fixed, but separately, and there is currently no one version of the IDE that contains both fixes.

Note that the upload error message is false. The upload actually does finish successfully. So you could continue to use the regular Arduino IDE and just ignore the spurious upload errors. If you do that, make sure to turn on File > Preferences > Show verbose output during: upload so that you can see from the contents of the black console window after the upload whether the upload error was spurious or legitimate.

Go Up