New
#1
Windows enumerating a huge number of COM ports
Hi. I have a puzzler that I hope that someone can shed some light on.
My company manufactures a device that uses a USB to serial integrated circuit (MicroChip MCP2200 USB to serial converter) to make a COM port for Windows to talk to. The chip works great and there are no issues with that, but something weird happens with the way that Windows is handling the COM ports.
Using a terminal program such as Putty or Hyperterminal, whenever you plug in the USB cable to a new device, Windows assigns it a COM port number. I would expect that Windows would use the next available COM port, such as COM5 for example. The weird thing about this is that for every new device plugged in, Windows increments the COM port number, so if you are dealing with 200 devices for example, you can get up to 200 com ports. (COM267 anyone?) It just keeps incrementing instead of using the same port over and over. I would expect it to reuse the next available COM port, like COM5, over and over again, but it doesn't. It just keeps on incrementing. I plugged a device into my laptop this morning and got COM983. It doesn't affect the operation of the device in question as the port is only used for maintenance/programming, but it strikes me as weird that Windows would not reuse the same COM port number. Not only that, but Windows remembers the COM port that it assigned, so if you go back and plug in device 380 for example, the COM port will be COM380.
As I said, it doesn't affect operation, but I am afraid that Putty or Hyperterminal will reach the maximum port allowed by the software and I won't be able to communicate with new devices. Is there a way to make Windows "forget" the previously assigned COM ports if this happens?
I suspect that some Registry fiddling might be in order.
If anyone has any insight on this, I am all ears.
- Windows 10, 22H2