Each time when you connect a new COM device or a USB device (true for modems, smartphones, Bluetooth, serial-to-USB converters, etc.), Windows detects it using Plug-n-Play and assigns it some COM port number in the range of 1 to 255. If this device is connected again, the reserved port is assigned to it. A new device gets the first free COM port number. It often occurs that, when being connected, the external devices create several COM ports at once. In my case after connecting a Bluetooth adapter 10!!! new COM ports has appeared in the system.
A number of applications (quite obsolete, as a rule) are able to address only two-digit COM port numbers and won’t work with COM100 or higher. In the worst cases, these programs work only with COM1-COM9 ports. What if a device has got a higher number? Could the numbering scheme of the reserved COM ports be reset and the assigned ports be deleted? Let’s try to deal with it in Windows 7.
As a rule, you are not able to change the assigned COM port in the hardware properties, since the system says that all “lower” COM ports are already in use.
How to Change a COM Port Number for a Specific Device
First of all, try to reassign the COM port number for a specific COM device manually. Suppose that the necessary COM port is already busy and we would like to free it.
- Start the Device Manager as follows:
set devmgr_show_nonpresent_devices=1
start devmgmt.msc
- Select View->Show Hidden Devices in the console menu.
- Expand Ports (COM & LPT) branch and find the device, which is assigned the necessary COM port in the list. (A pale icon means that this COM port is already assigned, but currently the device is not connected) Right-click it and select Uninstall.
- The freed up COM port can be assigned to another device. Find your device in the same branch, and open the Properties window. Then go to the Port Settings tab and click Advanced. In the dropdown list, select the free COM port.
This method is not always useful in trying to free up a busy COM port. Then you will have to make some changes to the registry.
How to Reset COM Port Binding Using the Registry
The information about busy COM ports is stored in CommDB registry key in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter section.
- Open the Registry Editor (regedit) and go to the branch mentioned above.Important! We strongly recommend to back up this registry branch (File -> Export) before doing anything. If something goes wrong, you can get back to the original port configuration.
- The value of ComDB parameter in the binary format determines the list of COM ports reserved in the system. Each bit determines the state of the corresponding port (from 1 to 255). For example, if you need to leave the reservation only for COM3, the hex value of ComDB is equal to 04 (0000 0100)
Important! Be very attentive, and don’t add any additional bits to the parameter, or the system will display the BSOD. - If you have to reset all COM port bindings, change the value of ComDB to 0.
- The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports branch contains the list of all assigned COM ports. All unnecessary ports may be deleted. In our example, we’ll leave only COM3 and delete the rest ports.
- Unplug all external devices and restart your computer.
- After the restart, connect the devices in the necessary order. (Reinstall USB-to-serial converters, etc.) All COM ports found by the system will be automatically identified by the system and assigned the COM port numbers one by one.
3 comments
Hi dear
When I open Device Manager there is no branch of (COM & LPT) to expand. How can I Add or Find it?
thank you so much
thanks you so much , life saving post 🙂 , i mostly work with iot devices and sometime com ports get busy and am getting com port busy returns in code so this saved my life in flushing com port