cancel
Showing results for 
Search instead for 
Did you mean: 

How do I give an stm32 USB device a more identifiable name?

ESpra.1
Senior

I don't know if this is possible, but I'm trying to make an stm32 device using USB CDC, and am trying to make it more "identifiable" by the computer as something beyond just a "USB Serial Device" on a specific com port. At the moment, I'm controlling the device via a python program on a PC, but I have to hard-code the specific com port assigned to the device, and that com port could change if I just moved the device over to another machine and ran the same program.

is it possible to mark a USB device with something very specific that a computer can identify beyond just being a "USB Serial Device", or would I have to make the computer check each com port for a desired response from any of the devices connected to it to see if it's the device that corresponds to the program?

7 REPLIES 7
Javier1
Principal

this has been asked several times, the showrt answer is:

You cant, youre using windows generic CDC driver, your PC will see COMX as port name and windowsor STMicroelectronics as manufacturer.

The way to overcome this is to create your own driver.

I wouldnt recommend to poll every COM port in order to get a valid reply.

Some COM ports are not happy when you try to connect to them (specially internal bluetooth / wifi cARDS and things like that)

https://community.st.com/s/question/0D53W00000Yv60oSAB/hii-would-like-to-rename-the-usb-device-name-when-it-is-connected-to-usb-port-and-recognized-by-windowsis-it-possible-to-show-a-custom-name-instead-of-stmicroelectronics-virtual-com-portthanks

we dont need to firmware by ourselves, lets talk
ESpra.1
Senior

That's more or less the conclusion I'd come to, but I wanted to check to see if I missed something. I do have a *sort of* work around, but it's not really a neat solution.

That said, I didn't really mean change the 'name', just something that I could put into the STM32 and have the python program find it, without having to sort through all the active com ports one by one, searching for the right device.

Pavel A.
Evangelist III

> is it possible to mark a USB device with something very specific that a computer can identify beyond just being a "USB Serial Device"

If the goal is to find your custom device - yes, of course.

Every USB device has vendor & device IDs that can be used for identification.

There are also other USB device properties that can be discovered by software.

The name visible in device manager is "USB Serial Device". That's is how win10/11 behaves.

It takes few more clicks to discover the custom name that comes from the device descriptors, but 99% of Windows users don't care.

>>It takes few more clicks

He is trying to use python , so whatever info the python serial library has access to, not much if i recall correctly.

>>discover the custom name that comes from the device descriptors.

I wasnt able to do this, not with Qt, not with python, i would be interested to hear more about this.

we dont need to firmware by ourselves, lets talk

@Javier Muñoz​ Windows has so called device install (Di...) API for reading properties of devices and discovering their connections/dependencies. This is documented in what once was MSDN.

The Device manager show many of these properties in the details tab:

0693W00000WKtmXQAT.pngThe name string from the device or function descriptor is "Bus reported device description". (this is optional, some devices do not have it)

The API is quite obtuse and painful to code.... but the similar thing in Apple OS/X is even worse IMO. It may be easier with libraries/wrappers for modern languages like C# and WinRT, I'm less familiar with these.

At the time, I was using python just to test whether a binary control method I'd put together was working, and it occurred to me that I didn't want to change what COM port I was connecting to in the code if I just started using a different microcontroller of the same type. If it works easier in a different language, I'm more than happy to give that a whirl.

It looks like that's just for composite devices. I'm using a CDC only at the moment.