cancel
Showing results for 
Search instead for 
Did you mean: 

USB only working in debug mode

SSmit.13
Senior

Hi

  I am working on an STM32L433 using STM32IDE. When running in debug mode, the USB CDC is recognized when plugging in the cable (into Windows 10 and 11) . But when I compile as release mode the USB isn't recognized . I am using the HAL for USB .

 

Anyone please help on this?

 

Best Regards

Scott

3 REPLIES 3
FBL
ST Employee

Hi @SSmit.13 

 

Try to lower optimization level to make sure you will get same behavior in debug mode. Then, check USB descriptors are properly configured. Connect directly USART RX to TX to test CDC in loopback.

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.


I'm out of offce with limited access to my emails.
Happy New Year!
SSmit.13
Senior

Sorry, the USB is working in release mode, I have just realized that its reading an input pin that always reads 0v . I use a jumper to detect whether to use the USB or not, and it always reads 0v in release .

 

I have made a new thread based on this issue

 

Many thanks

Scott

 

 

FBL
ST Employee

Hi @SSmit.13 

To conclude, by ensuring proper synchronization with the __DSB() instruction, you can avoid timing issues and ensure reliable operation in both debug and release modes.

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.


I'm out of offce with limited access to my emails.
Happy New Year!