[bug report] USB CDC Serial Number in release build not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-15 2:44 AM - last edited on ‎2024-07-15 2:47 AM by Andrew Neil
Hello, I would like to report a bug on USB CDC middleware generated from CubeMX 6.11.
When I use it in Debug build, everything works as expected. Once I switch to Release, the compiler optimizes out the serial number. I use official VScode extention with Cmake to build the FW.
Without a serial number at USB device, Windows fails to recognize that anything is connected. It works in Linux only.
I have the same issue happen at STM32F411 and STM32L433.
The solution was to add initalization to 3 lines in USB_DEVICE\App\usbd_desc.c
uint32_t deviceserial0 = *(uint32_t*)DEVICE_ID1;
uint32_t deviceserial1 = *(uint32_t*)DEVICE_ID2;
uint32_t deviceserial2 = *(uint32_t*)DEVICE_ID3;
I hope this helps someone and the STM may fix it. No support is needed.
Thanks.
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-15 2:50 AM
Hello @yourigh
This is a Know issue (as what is in this post) that has been solved on the Version 6.11.1 and 6.12.0. So, you just have to update your STM32CubeMX to the last version.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-15 2:50 AM
Hello @yourigh
This is a Know issue (as what is in this post) that has been solved on the Version 6.11.1 and 6.12.0. So, you just have to update your STM32CubeMX to the last version.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
