2022-01-27 07:10 AM
I would like to test USB on an STM32L476 Nucleo-64 development board. I use STM32CubeMX version 6.2.1 and the library it's using is "STM32CubeL4 Firmware Package V1.17.0 / 11-February-2021". I select Nucleo-64 in Board Selector in STM32CubeMX and then simply enable Connectivity->USB_OTG_FS and Middleware->USB-DEVICE and choose "Class For FS IP": Communication Device Class (Virtual Port Com)" and generate the code, compile it and then upload it to the microcontroller. When I execute the code, it says "Unknown USB Device (Device Descriptor Request Failed)" in the Device Manager (on Windows 10). I have googled quite a bit and tried a lot of things (limit the packet size, increase stack & heap size, disabling other peripherals on the board, etc), but to no avail. I have confirmed that I get OTG_FS_IRQHandler interrupts when I plug in the USB-cable. When I probe the data wires on my oscilloscope, I see clean signals, but to my surprise the "smallest bits" are 667 ns wide, meaning 1.5 Mbits/s (but maybe I''ve misunderstood how the USB-protocol works, especially during the very early stages of the connect process). I have made no hardware changes whatsoever to the PCB. I can see that SB31 is connected and I can measure 3.3 V on VDDUSB as soon as I turn on power. The only wires I have connected are GND, USB_OTG_FS_DP and USB_OTG_FS_DM and the wires are short and twisted pair (only data wires). I'm using internal clock (HSI) with a bunch of PLL:s and dividers and the STM32CubeMX clock configuration doesn't complain. Does anybody know what I'm doing wrong?
Solved! Go to Solution.
2022-01-27 08:26 AM
I had swapped the USB_OTG_FS_DP and USB_OTG_FS_DM wires, I will immediately go to the shame corner.
2022-01-27 07:20 AM
Hello @arnold_w ,
Maybe the problem is with your USB cable, so try a different cable, and make sure that the connections are OK.
Try also to increase the heap size in CubeMx setting.
Please keep me informed about your progress on this issue.
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2022-01-27 07:38 AM
I've tried increasing the heap (to 0x1500) and my data signals look clean on the oscilloscope. Please note that this development board doesn't have a proper USB-connector (except for the one that ST-LINK Utility is communicating via, but I can't use that one).
2022-01-27 08:26 AM
I had swapped the USB_OTG_FS_DP and USB_OTG_FS_DM wires, I will immediately go to the shame corner.