cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC: How to avoid windows from creating a new COM port for every device?

taraben
Senior

After updateing to new CubeMX 5.1 my STM32F437 devices acuiring new COM ports per device.

It seems that device serial string descriptor is filled by CPU UID instead of hardcoded 00001A value. The PID is 5740, VID is 0483.

THis causes the USB stack on windows to assign new COM port per newly identified serial number.

I found this: https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-device-specific-registry-settings

using IgnoreHWSerNum Key windows should not identify by serial number string. But only PID/VID.

Has someone experience with this?

Some other Search result states that those key might not work on USB3 ports.!?

Any hints?

Regards, Adib.

2 REPLIES 2
Clive1 (HNL)
Senior II

The serial number is typically used so the OS can keep the same COM port number regardless of the port it is plugged into.

If you don't want this behaviour consider using the same, non-zero, serial number for the parts.

When we used test machines we regularly had to purge the registry of junk, and wrote code to find the available and connected COM ports.

taraben
Senior

Hello Clive,

Thanks for your prompt answer.

I have no idea why ST changed that behavior and why I can not overwrite. I have to patch the usbd sources that get overwriten every time I regenerate the code by CubeMX :(

So you mean that the old behaviour is the recommended one.? And not using the patch for Windows machines.

(On Linux they give the COM ports always starting from 0 🙂 )

Adib.

--