cancel
Showing results for 
Search instead for 
Did you mean: 

[bug report] USB CDC Serial Number in release build not working

yourigh
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

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.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

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.