Windows 10 serial port COM port changes - Page 1
Forum section: electronics / general

author: tkamiya
author_rank: Super Contributor
timestamp: September 28, 2019, 08:18:35 pm
content: 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

author: drussell
author_rank: Super Contributor
timestamp: September 28, 2019, 08:28:57 pm
content: 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

author: drussell
author_rank: Super Contributor
timestamp: September 28, 2019, 08:39:37 pm
content: 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=1start devmgmt.mscI 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)

author: tkamiya
author_rank: Super Contributor
timestamp: September 28, 2019, 09:30:32 pm
content: 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.

author: nctnico
author_rank: Super Contributor
timestamp: September 28, 2019, 11:55:49 pm
content: 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.

author: james_s
author_rank: Super Contributor
timestamp: September 29, 2019, 12:16:46 am
content: Quote from: tkamiya on September 28, 2019, 09:30:32 pmThat'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.

author: drussell
author_rank: Super Contributor
timestamp: September 29, 2019, 12:26:06 am
content: Quote from: nctnico on September 28, 2019, 11:55:49 pmActually, 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

author: james_s
author_rank: Super Contributor
timestamp: September 29, 2019, 12:28:11 am
content: Windows attempts to remember specific devices, but if the device lacks a unique identifier there is not really much that can be done.

author: drussell
author_rank: Super Contributor
timestamp: September 29, 2019, 12:35:15 am
content: Quote from: james_s on September 29, 2019, 12:28:11 amIndeed. 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... ... ...

author: Electro Detective
author_rank: Super Contributor
timestamp: September 29, 2019, 02:00:45 am
content: 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 etci.e. plug in, switch on, get paid, thanked, walk away stuff I prefer

author: tkamiya
author_rank: Super Contributor
timestamp: September 29, 2019, 02:19:08 am
content: Right..... if this was an older USB kind, I wouldn't be surprised. This thing connects to PCIe bus. I thought it was strange.

author: james_s
author_rank: Super Contributor
timestamp: September 29, 2019, 02:52:00 am
content: Oh that is strange, I'm not sure why I assumed it was USB.

author: tkamiya
author_rank: Super Contributor
timestamp: September 29, 2019, 03:24:48 am
content: 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.

author: drussell
author_rank: Super Contributor
timestamp: September 29, 2019, 03:55:02 am
content: Quote from: Electro Detective on September 29, 2019, 02:00:45 amYeah, 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.Way to go, Microsoft.Decades into USB and we're still doing Plug-And-Pray at it's finest.

author: nctnico
author_rank: Super Contributor
timestamp: September 29, 2019, 01:06:56 pm
content: Quote from: drussell on September 29, 2019, 12:35:15 amI 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.

author: james_s
author_rank: Super Contributor
timestamp: September 29, 2019, 05:20:05 pm
content: 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.

author: Bicurico
author_rank: Super Contributor
timestamp: September 29, 2019, 06:13:47 pm
content: 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