2024-03-26 9:57 AM - edited 2024-03-26 10:13 AM
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):
;)
)
2024-03-26 10:17 AM - edited 2024-03-26 10:20 AM
Just a bug. Consistent serial numbers can be created from anything else, for example programmed in OTP flash or eeprom.
2025-08-25 7:07 AM
Hi, I am also having this problem with CubeMX 6.11.0 and STM32Cube FW_F4 V1.28.2. Was this bug fixed? I think this is the reason that my device is always detected as a new COM port.
2025-08-25 8:31 AM
Just check in the sources (generated by Cube?) if there still are un-initialized variables. Fix as needed.
Also note that in Windows it is possible to ignore the "serial numbers" for specific VEN/DEV combination. If you don't see any "serial number" on the host side, it could be that.
2025-08-26 6:02 AM
Thank you for your response!
I know how to fix it (and indeed initializing these variables fixed the USB problem for me). The question was whether this bug was fixed by ST in later versions of Cube template. This use of uninitialized variables is clearly Undefined Behavior and can as well reboot your MCU or wipe your flash if another version of compiler feels like it.