Author Topic: Windows 10 serial port COM port changes  (Read 3913 times)

0 Members and 1 Guest are viewing this topic.

Offline tkamiyaTopic starter

  • Super Contributor
  • ***
  • Posts: 2178
  • Country: us
Windows 10 serial port COM port changes
« on: September 28, 2019, 08:18:35 pm »
I have an ordinary Lenovo PC running Windows 10.  To it, I've installed several multi-port serial ports.  Everything worked UNTIL I rebooted.  Before, COM port numbers had gaps but now it's sequential.  There is nothing wrong with sequential numbers but I'm not liking the fact the numbers changed by rebooting.

I did look around and appears this is a common complaint.  There seems to be no concrete and sure way to fix it.  What a silly oversight by Microsoft!

I'm planning to use these ports to control test equipment.  It would be really confusing if this happens every time.  How do deal with this??

This is the card I use.
https://www.amazon.com/gp/product/B004WKTBHW/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
 

Offline drussell

  • Super Contributor
  • ***
  • Posts: 1855
  • Country: ca
  • Hardcore Geek
Re: Windows 10 serial port COM port changes
« Reply #1 on: September 28, 2019, 08:28:57 pm »
Just like previous version of Windows, you should be able to assign specific com ports in:

Device Manager -> Ports -> (select desired port) -> Properties -> Port Settings -> Advanced
 

Offline drussell

  • Super Contributor
  • ***
  • Posts: 1855
  • Country: ca
  • Hardcore Geek
Re: Windows 10 serial port COM port changes
« Reply #2 on: September 28, 2019, 08:39:37 pm »
P.S., if you need to see any "hidden" comm ports from devices that Windows can't see at the time, have been removed, unplugged or disabled, you can do the following from a command prompt:

set devmgr_show_nonpresent_devices=1
start devmgmt.msc


I had to do this about a week ago on a Windows 2000 machine that I swapped a new motherboard into at the car wash...  The machine has several RS-485 to RS-232 converters connected to it that go to the various PLCs controlling sets of 4 bays, allowing monitoring and control.  Some are on the on-board ports, others are on serial cards, it also has a USB modem connected to it and an old leftover Winmodem...  I didn't want to mess with the software configs, etc. (I didn't set this up decades ago :) ) so I just cleared all the old ones and moved the important things back to where they were previously like com:2,4,5 instead of 11,12 and 17 or whatever crazy high numbers they had been re-detected on after swapping motherboards)  :)
 
The following users thanked this post: BravoV, blueskull, Electro Detective

Offline tkamiyaTopic starter

  • Super Contributor
  • ***
  • Posts: 2178
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #3 on: September 28, 2019, 09:30:32 pm »
Thank you.  It worked!

I've been using Windows since it was first introduced.  I've never had to reassign com ports this way.  It used to be jumper settings on the physical card.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28247
  • Country: nl
    • NCT Developments
Re: Windows 10 serial port COM port changes
« Reply #4 on: September 28, 2019, 11:55:49 pm »
The problem is likely in the devices themselves. If a USB product doesn't have a unique number then Windows will assign the ports randomly at every start or when you plug / unplug. There is no way the OS (any OS) can check which device has been plugged into a specific port if it doesn't have some way to be indentified uniquely. In the software I write myself I always use serial port scanning to find specific devices so there is no reliance on exact port assignments.
« Last Edit: September 28, 2019, 11:57:44 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #5 on: September 29, 2019, 12:16:46 am »
Thank you.  It worked!

I've been using Windows since it was first introduced.  I've never had to reassign com ports this way.  It used to be jumper settings on the physical card.

That's not really the fault of the OS, the USB comm ports have no jumpers to set, they are enumerated when plugged in or when the PC is booted. Better ones have an onboard EEPROM that stores a unique ID but I have encountered many that don't and unplugging those and plugging them in a different port will cause them to enumerate as a new device. There is nothing the OS can do about this.
 

Offline drussell

  • Super Contributor
  • ***
  • Posts: 1855
  • Country: ca
  • Hardcore Geek
Re: Windows 10 serial port COM port changes
« Reply #6 on: September 29, 2019, 12:26:06 am »
The problem is likely in the devices themselves. If a USB product doesn't have a unique number then Windows will assign the ports randomly at every start or when you plug / unplug. There is no way the OS (any OS) can check which device has been plugged into a specific port if it doesn't have some way to be indentified uniquely

Actually, that's not true.  Windows remembers specific USB devices in addition to traditional ISA/PCI/PCIe comm ports and assigns a new COMx: port number every time it thinks it sees a new device.

(Edit: It may be as coarse-grained as just the USB device ID and the bus it was on if Windows cannot determine a unique serial number, for example, but if you plug even the most generic USB-Serial adapter into a different bus, you will create another COMx: port number than the device had on the previous bus, etc.)

This is a common problem for people who need to, for example, run older software that expects the standard DOS port mapping where you only have access to COM1-4: and their USB device is showing up at 5 or 12 or whatever.  That is the most common use for the "unhide devices" trick I showed above, clearing out rogue COMx: ports that no longer exist or were a user trying a USB dongle on different USB ports that are on different host controllers, etc. etc.

There is a whole special "ComDB" database infrastructure for serial port info in Windows, you can't even access everything or delete all your ports, etc. from the registry.  Some more info about the programming interface to manipulate the comm port database is here:

https://docs.microsoft.com/en-us/windows-hardware/drivers/serports/com-port-database
« Last Edit: September 29, 2019, 03:45:42 am by drussell »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #7 on: September 29, 2019, 12:28:11 am »
Windows attempts to remember specific devices, but if the device lacks a unique identifier there is not really much that can be done.
 
The following users thanked this post: Kilrah

Offline drussell

  • Super Contributor
  • ***
  • Posts: 1855
  • Country: ca
  • Hardcore Geek
Re: Windows 10 serial port COM port changes
« Reply #8 on: September 29, 2019, 12:35:15 am »
Windows attempts to remember specific devices, but if the device lacks a unique identifier there is not really much that can be done.

Indeed.  If for example, you have two identical uber-generic USB-Serial adapters plugged into the same USB root hub, it is not going to reliably assign COMx: to one and COMy: to the other at reboot time if they're both plugged in on startup.

The OP was talking about PCIe cards, of course, so this isn't quite the same as USB, although many USB serial devices DO have unique identifiers beyond the device type ID and ARE uniquely identifiable to Windows. 

If you folks had only seen some of the crazy lists of COM: ports I've seen on Windows machines from previously-plugged devices...  ... ...  :)
 

Offline Electro Detective

  • Super Contributor
  • ***
  • Posts: 2715
  • Country: au
Re: Windows 10 serial port COM port changes
« Reply #9 on: September 29, 2019, 02:00:45 am »

The USB thing caught me out a few times and caused drama when plugging stuff back in after a PC service, re-location, or single PC replacement in a network etc.

I now label and or map what USB device plugged in to where exactly, no matter how long that takes..
and the OS and or network or printer doesn't care if it's a new hard drive, board swap, new PC with same OS etc

i.e. plug in, switch on, get paid, thanked, walk away stuff I prefer  :clap:

 

Offline tkamiyaTopic starter

  • Super Contributor
  • ***
  • Posts: 2178
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #10 on: September 29, 2019, 02:19:08 am »
Right.....  if this was an older USB kind, I wouldn't be surprised.  This thing connects to PCIe bus.  I thought it was strange.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #11 on: September 29, 2019, 02:52:00 am »
Oh that is strange, I'm not sure why I assumed it was USB.
 

Offline tkamiyaTopic starter

  • Super Contributor
  • ***
  • Posts: 2178
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #12 on: September 29, 2019, 03:24:48 am »
I found a potential problem.  Device driver that was loaded by default was from 2014.  Updated to the latest (2016).  Hopefully, this one is better.
 

Offline drussell

  • Super Contributor
  • ***
  • Posts: 1855
  • Country: ca
  • Hardcore Geek
Re: Windows 10 serial port COM port changes
« Reply #13 on: September 29, 2019, 03:55:02 am »
The USB thing caught me out a few times and caused drama when plugging stuff back in after a PC service, re-location, or single PC replacement in a network etc.

Yeah, that can be a bit of a pain, but usually it is just the drivers.  If it isn't looking for a Windows built-in driver, it (stupid Windows) will probably want to know the path to the original driver installation media, even if the driver is already installed, even if the device was previously working fine before plugging it into a different port.  Of course, years later the directory it was installed from is often long gone.

The trick in those cases is to simply point it at the directories where the actual (already installed) files are.  This often takes a couple minutes as you point it back and forth between Windows/System32/Drivers and Windows/System32... or the INF folder, and sometimes some C:\Program Files or Common Files or whatever place the particular file is hiding.... but it works.

If the usual C:\Windows\System32 and ..\Drivers don't work, I just open a search dialog and search for the various filenames as the installation process asks for them, then point it to that directory, hit OK, then repeat until it has "re-loaded" all the files from their existing locations.   :palm:

Way to go, Microsoft.   :-DD   Decades into USB and we're still doing Plug-And-Pray at it's finest.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28247
  • Country: nl
    • NCT Developments
Re: Windows 10 serial port COM port changes
« Reply #14 on: September 29, 2019, 01:06:56 pm »
The OP was talking about PCIe cards, of course, so this isn't quite the same as USB, although many USB serial devices DO have unique identifiers beyond the device type ID and ARE uniquely identifiable to Windows. 
I looked passed that and assumed the OP was using USB. I think I have tried to use PCI serial port cards in the past but for some reason my experience with USB to RS232 adapters has been far better.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Windows 10 serial port COM port changes
« Reply #15 on: September 29, 2019, 05:20:05 pm »
That's surprising really, I would have expected PCI-e to be more robust like a real hardware serial port, however these days maybe the USB stuff is so much more common that it gets more attention.
 

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1794
  • Country: pt
    • VMA's Satellite Blog
Re: Windows 10 serial port COM port changes
« Reply #16 on: September 29, 2019, 06:13:47 pm »
Sorry if I repeat somthing that has been said already (did not read all the posts):

1) If you connect the same USB device that creates a virtual COM port to a different USB port, it will receive a different COM number. Make sure you plug devices always to the same USB port.
2) As already said, you can specify what device get which COM port. Just make sure you don't assign the same COM port twice. That gives some odd results.
3) Take care what driver you install. Never is not always better! If you use a USB device that uses a clones PROLIFIC chip, a new driver may not work at all. I always keep an old driver for this device (2009). It works fine with cloned IC's.

Regards,
Vitor


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf