"Device Descriptor Request Failed" (Code 43) when using STM32CubeMX-generated code on STM32L476 Nucleo-64 development board
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?
