cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 USB CDC fails with STM32Cube MCU package of STM32L4 version 1.12.0

PSiri
Associate

On STM32L476 Discovery and TrueSTUDIO 9.0.1, USB CDC fails on Windows 10, if code is generated by STM32Cube MCU package of STM32L4 version 1.12.0. Back to version 1.11.0, it works fine. Furthermore, at 48 MHz USB clock, if SYSCLK = 48 MHz, the USB code is OK. But if SYSCLK = 16 MHz, the USB code fail. Why ?

8 REPLIES 8
Jerome Godbout
Associate II

I observe the same problem with 1.12, I was on 1.8.1 and it was working fine, but after update I could not make it work. I will try 1.11 to see if it also solve my problems.

For the USB, make sure the clock is precise to 48 MHz for the USB part. If this clock is not precise enough the USB will not work. You can give a look at the clock documentation to see if this is supported.

Jerome Godbout
Associate II

Here is my setting with a SysClock of 16 MHz that work for USB if that might help:

Jerome Godbout
Associate II

Sorry, seem like the image did not follow0690X000006C1RAQA0.png

Jerome Godbout
Associate II

Can confirm 1.11.0 is working fine on my side, but 1.12.0 is breaking everything.

sqnewton
Associate

I am trying 1.13.0 and it says that the file isn't available (while downloading from the site) and if I do it from local it says Problem During Unzip of file... Any clues on how to make this work?

Rob.Riggs
Senior III

If you have enabled battery charger detection, that is certainly broken in 1.12.0 (see my post reporting the defect for the work-around). Otherwise, I have USB CDC working on 1.12.0 just fine. I don't recall having to make any other changes to my project when upgrading from 1.8.1, but I could certainly be forgetting something. Nothing in the diff stood out (lots of noise in the diff though).

If you are compiling at high optimization with GCC, note that I had to back of from -O3 to -O2 with 1.12.0. Modern GCC will just ignore code that attempts to invoke UB.

Jerome Godbout
Associate II

Humm, 1.12.0 doesn't even have a descriptor working on my side after the upgrade at -O0

STM32L476 here too. I have a composite with CDC and HID, but even the descriptor is destroyed by the update, so the device cannot even connect to the host properly when plug-in.

I did try the 1.13.0, it does make the same problems as the 1.12.0, less noisy update since the callback to replace the __weak were reverted. I don't see anything wrong of the bat, but a lot of changes did occurred regarding the USB STALL state.

Rob.Riggs
Senior III

I have USB CDC working on a '433 part with 1.12.0 HAL. There could be a problem in the OTG support that I am just not hitting.