cancel
Showing results for 
Search instead for 
Did you mean: 

USB VCP Get_SerialNum

le-gal.guillaume
Associate II

Hello Everybody,

 

I use STM32CubeIDE1.15.0 Build: 20695_20240315_1429 and a custom board with a STM32303RE inside.

I use the IOC interface to set the virtual port com. Everything work fine, just a detail: when i connect, then disconnect and reconnect the USB port, the port com number on Windows change, It increase (search the next available number)! The VID and PID are always the same, so I focus on the serial number, and i found that (code generate by STM32CubeIde):

 
usbd_desc.c:
 
legalguillaume_0-1711471641088.png
3 undefined local variables, which are used to generate the serial number. Each time I connect the USB cable, the values change=>so the serial number change.
 
Is it normal? Is it a (strange) way to generate a randomize serial number?
Just a bug?
 
 
(VCP number seems better with this fix:
legalguillaume_0-1711473139330.png

 

😉

)

 
 
 
BR,
Guillaume Le Gal
 
 
1 REPLY 1
Pavel A.
Evangelist III

Just a bug. Consistent serial numbers can be created from anything else, for example programmed in OTP flash or eeprom.

See also: https://community.st.com/t5/stm32-mcus-products/stm32f103ze-usb-login-to-windows-with-the-same-comport/td-p/654424