In my line of work, I spend a lot of time interfacing to devices using a Serial (RS232) connection. This often necessitates the use of USB to Serial port converters.
A frustrating issue I often come up against is that, each time a new one of these converters is attached, or indeed an existing to a new USB port, it allocates itself a new port.
This port is then not automatically freed again by Windows, which means that you end up with a bunch of reserved serial ports allocated to converters which are no longer attached or used. Further, you cannot ordinarily see USB devices which have been removed from the system, so manually removing the devices isn’t simple either.
To get around this, you can perform the following steps to allow you to show the removed USB devices, and uninstall them, freeing the ports, and allowing you to reallocate your device com ports;
- First, remove any USB to Serial Converters you may have attached, as these will have live allocated COM ports.
- Then. launch a Command Prompt as Administrator, by right clicking on the Command Prompt shortcut, and selecting “Run as administrator”;
- We now need to allow the Device Manager to let us see removed USB devices. So, type; set devmgr_show_nonpresent_devices=1 and hit Enter… Don’t worry, nothing will be shown in response to this;
- Next we need to launch the Device Manager as an Administrator, so type; start devmgmt.msc and hit the Enter key, which will bring up the Device Manager in Administrator mode (Note starting it normally through the windows GUI won’t open Device Manager as an Administrator).
- Now we want to show all the Hidden USB devices, so click the View menu and select “Show hidden devices”;
- You’ll now see that a bunch of extra nodes have been added to the Device tree. The one we’re interested in is the Ports (COM & LPT) section. So expand this node by clicking the small arrow to the left of the label;
- You should now see a selection of devices which appear slightly greyed out. Each device will indicate it’s allocated COM port. All we need to do is remove each of these devices, freeing up its COM port. This is achieved by simply selecting the device you want to remove, and either hitting the Delete key on your keyboard or going to the Action menu and selecting Uninstall.
- Each time you attempt to uninstall a device you will be asked to confirm the uninstallation. There will also be a checkbox to allow you to “Delete the driver software for this device”. You can leave this un-ticked, as we know we’ll need to use this device in the future.
- You should now be able to re-connect your USB to Serial Port Converters, watch each one get reinstalled, where WIndows will automatically assign the lowest COM port available.
- You can of course select your own choice of COM port for each device. This is achieved by right clicking on the device who’s COM port you wish to change and selecting Properties;
- This will bring up the Device Properties window. From here select the Port Settings Tab, and press the Advanced Button;
- This will show the Advanced Settings for the COM port. The COM Port Number can then be selected from the “COM Port Number” dropdown;
- Select your COM port, And OK all the open Windows.
I hope this helps somebody else as much as it helped me!