How Are the COM Ports for My USB Serial Device Assigned?

Updated Jan 13, 2023

Reported In

Software

  • Measurement and Automation Explorer (MAX)

Driver

  • NI-Serial

Issue Details

I'm using a USB serial device like the USB-232. When I plug in my device, I always get the same COM ports assigned to it. If I plug in a second USB serial device, it is assigned different ports, even if the first USB-232 is not still plugged in. Why does that happen? How are the ports assigned?

Solution

There is a simple way to deallocate COM ports that are unused if this behavior is undesirable. You must have administrative rights in order to configure these settings. After you have unplugged the original USB-232 from your computer, open Measurement & Automation Explorer (MAX). In MAX, select Tools»NI-Serial»Recover Unused COM Numbers. This clears the Windows registry of all ports that are not currently connected.
 

Additional Information

The NI-Serial driver has functionality that allows it to keep track of serial port properties, including COM port numbers. For example, say there are two USB-232 devices and each port of each device is connected to a different instrument. Each instrument has different serial properties. So each serial port will have to have these properties.

The Windows registry stores this information by the serial number of the USB device and the port number. This way, each time you plug a given USB-232 into that computer, it will retain the selected properties. Thanks to this feature, you do not have to configure the port every time you plug in the device. A side effect of this functionality is that every new device must be assigned to an entirely new COM port, one which had never been used on that computer.