cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC Class Driver

lee_trueman
Associate II
Posted on January 02, 2013 at 12:00

Hi All,

is this normal ? 

Using 103F along with ST USB CDC Libs on my board and it seems that the USB driver on the PC negotiates a new COM port for every new board i connect to the PC.

Normally this is not a problem but when the units are been tested, they are tested on one PC, thus that PC ends up with 100s of used COM ports.

Having worked with Microchip USB CDC all board would use the first instance of COM port that was negotiated.

Is there somthing i need to change in the libs to ensure the PC driver does not create a new COM port every time a new board is plugged in ?

4 REPLIES 4
Posted on January 02, 2013 at 16:16

Is there somthing i need to change in the libs to ensure the PC driver does not create a new COM port every time a new board is plugged in ?

Have them report the same, non-zero, serial number.

As I recall a zero serial, will be assigned a USB port specific COM#, and unique one will be assigned a unique COM# regardless of which USB port it is attached too.

If the devices need unique serial numbers you'll need to clear out the device enumeration in the registry.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
lee_trueman
Associate II
Posted on January 02, 2013 at 17:58

Hi Clive,

How does one achieve this ?

Posted on January 02, 2013 at 20:45

Well the serial number is in one of the descriptors passed back by your device.

Having a fixed serial number for all devices might been seen as undesirable by the end user. You might want to control test behaviour by using a pin to identify when it is in a test fixture.

You might also want to review how your Microchip products were enumerated by the system to understand how they worked.

Back when I worked on Windows stuff, there was a Device Manager API to fix/update the enumeration. I was also possible to delete/remove appropriate parts of the registry related to device enumeration. Finally you could use Filter drivers to intercept the data to/from the USB devices to alter their behaviour. So for example you could write one for your test system to mollify the problem you describe, whilst the shipped product would enumerate appropriately.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tbenson
Associate II
Posted on January 04, 2013 at 14:18

We just went through this with a board. The solution was to uninstall the driver then add a registry value to the test machine. This value tells the machine to ignore the serial number for a given vendor/product ID combination.

The registry key is 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags

and you will want to add an entry with the name ''IgnoreHWSerNumVVVVPPPP'' and a binary value of 01 (VVVV is your vendor ID and PPPP is your product ID)

Note that you need to clean out your old drivers completely before doing this. I used a program called usbdview (http://www.nirsoft.net/utils/usb_devices_view.html)

So the procedure went like this: 

1) uninstall all drivers referencing the VID and PID of your device

2) add the registery entries for your VID and PID

3) install your device again

Now it should use the same com port each time. Hope that helps. Also, this was done on windows XP, I'm not sure if it works under 7.