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.
Solved! Go to Solution.
2025-09-04 2:34 AM
Hi @FBL
I checked discovery kit (DK) USB device example (mass storage). But I don't use USB HS and power delivery (PD) (yet) so that code didn't help much. But after comparing CDC code to mine and wondering about that HSE / PLL3Q issue I found the problem. I was configuring USBPHYC clock source (orange box) but not the OTG FS clock source (red box). The code generator in HAL_PCD_MspInit was setting up OTG FS clock and it was PLL3Q at 200 MHz which obviously doesn't work.
So no problem with code generator, it was my fault.
After choosing USBPHY48 as source for OTG FS I got stuck at core reset issue, but for that I found cure from your post here: https://community.st.com/t5/stm32-mcus/faq-troubleshooting-a-usb-core-soft-reset-stuck-on-an-stm32/ta-p/803224
So, double the thanks!
2025-09-03 10:30 AM
2025-09-04 2:34 AM
Hi @FBL
I checked discovery kit (DK) USB device example (mass storage). But I don't use USB HS and power delivery (PD) (yet) so that code didn't help much. But after comparing CDC code to mine and wondering about that HSE / PLL3Q issue I found the problem. I was configuring USBPHYC clock source (orange box) but not the OTG FS clock source (red box). The code generator in HAL_PCD_MspInit was setting up OTG FS clock and it was PLL3Q at 200 MHz which obviously doesn't work.
So no problem with code generator, it was my fault.
After choosing USBPHY48 as source for OTG FS I got stuck at core reset issue, but for that I found cure from your post here: https://community.st.com/t5/stm32-mcus/faq-troubleshooting-a-usb-core-soft-reset-stuck-on-an-stm32/ta-p/803224
So, double the thanks!