2025-09-03 8:31 AM
Dear ST,
I'm trying to get USB CDC device working on custom STM32H7R3L8HxH based board. Host (Windows) detects it but unfortunately the USB device fails to enumerate with error:
Windows has stopped this device because it has reported problems. (Code 43)
A request for the USB device descriptor failed.
USB FS based Boot ROM works in DFU mode so I know hardware should be okay.
I found a bug in CubeMX code generator. USBPHY clock source is configured to be HSE (which is 24 MHz):
However code generator creates usbd_conf.c function HAL_PCD_MspInit with these lines:
/** Initializes the peripherals clock
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USBOTGFS;
PeriphClkInit.UsbOtgFsClockSelection = RCC_USBOTGFSCLKSOURCE_PLL3Q;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
I confirmed with debugger in SFR view that indeed OTGFSSEL bits in RCC_CCIPR1 are set to PLL3/Q.
STM32CubeIDE version is 1.19.0 and MxCube version is 6.15.0.
Unfortunately manually fixing clock to HSE did not make it work. So there is probably another problem.
USB settings are:
Only change in code is calling USBD_Start() after USB has been initialized in MX_USB_DEVICE_Init.