How to get stable COM-ports for USB serial dongles in Windows XP?

51,863

Solution 1

In my experience, plugging the device into the exact same USB port each time results in it getting the same COM port number.

It's also possible to change the port number assigned to a device (Device Manager, edit Properties of the COM port) if you need to plug it into a different USB port. In the past I have labeled a device with a COM port number, and then plugged it into each USB port on my laptop and reassigned the COM port to be that number, regardless of where it's plugged in.

Solution 2

The FTDI driver will assign serial ports to the same COM ports by the serial number of the device connected. So, the ports should remain the same regardless of USB port. However, if you plug in a new USB device, it will not reuse the previously assigned COM ports.

FTDI has an app note explaining the process in more detail.

I've had general stability problems with Prolific drivers, so I do not use Prolific USB-to-serial devices and can't comment on their mapping strategy.

Solution 3

Use ComPortMan to bind COM port numbers to devices. Taken from the Help page, here's an example ComPortMan.INI:

[ComPorts10]
DeviceID=USB\VID_067B&PID_2517
PortName=COM5

[ComPorts20]
DeviceID=USB\VID_1234&PID_5678
PortName=COM6

Note: I've found that sometimes a * needs to be appended to the Device ID for this to work.

Solution 4

The FTDI config tool can, I believe, set fixed COM port numbers and rename devices to show up as being "Your product name", which makes it easier to find the device programmatically if it does move around (you're not just looking for COM ports).

Solution 5

Every FTDI device has a serial number.. in your software, when enumerating (looping) through the available FTDI devices.. yes you can have many multiple FTDI devices plugged in at once.. ask the user to select the approp. device. and save and restore the serial number each time you loop through the available devices..

Share:
51,863
starblue
Author by

starblue

I'm a free-lance embedded software developer who likes computer science, mathematics, electronics and foreign languages. eiπ + 1 = 0 eπ√163 ≅ 6403203 + 744 rot13("fr") = "se"

Updated on February 04, 2020

Comments

  • starblue
    starblue about 4 years

    I develop embedded systems and need serial ports for communication.

    In Windows XP the numbers for USB serial port dongles keep moving around, which makes it hard to use in scripts or makefiles (for example for flash programming NXP controllers via their built-in bootloader, or for controlling a target and two lab devices at the same time).

    Is there a way to fix the COM-port for such a dongle? In Linux I can do this via udev by matching against the serial number of FTDI dongles (see this answer I just gave while searching for an answer to this question).

    • user1703401
      user1703401 over 11 years
      This is entirely the responsibility of the driver for the USB device, it picks the port names when it creates them. Some of them add a property page to the Device Manager property sheet let you pick a number but that's not widely implemented. What you've got left is an WMI query for Win32_SerialPort, not ideal either.
    • TJD
      TJD over 11 years
      As tomlogic mentioned, the easy solution is to plug your devices into a fixed port or hub, then they won't change. However, on windows you can still dynamically do the detection, you just have to look in the registry instead of udev. You will find your device info including COM port under SYSTEM\CurrentControlSet\Enum\FTDIBUS
  • starblue
    starblue about 11 years
    Thanks. The setting under Ports -> USB Serial Port -> Properties -> Port Settings -> Advanced did the trick quite conveniently, I wonder why I didn't find it myself (in german it is Anschlüsse -> USB Serial Port -> Eigenschaften -> Anschlusseinstellungen -> Erweitert).
  • jeb
    jeb over 10 years
    I can confirm the same, FTDI works stable for a long time, but Prolific are unstable and causes also bluescreens and the drivers are a nightmare