2025-09-29 9:17 AM
Hello ST team,
I’m using an STM32F723 microcontroller with USB HS (High Speed) in Communication Device Class (CDC) mode.
Everything worked perfectly using:
STM32CubeMX v6.10.0
STM32Cube FW_F7 v1.17.1
However, after migrating the project to:
STM32CubeMX v6.13.0
STM32Cube FW_F7 v1.17.4
the USB HS initialization fails due to what appears to be a missing clock enable definition and configuration in the generated code.
In the generated usbd_conf.c file, inside:
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
Previously (working version) CubeMX generated:
/* Peripheral clock enable */
__HAL_RCC_OTGPHYC_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
After the update, the generated code only contains:
__HAL_RCC_OTGPHYC_CLK_ENABLE();
As a result, the USB HS peripheral never initializes properly, and the code hangs in a timeout during initialization, specifically here:
stm32f7xx_ll_usb.c → function USB_CoreInit():
ret = USB_CoreReset(USBx);
/* Wait for AHB master IDLE state. */
do {
count++;
if (count > HAL_USB_TIMEOUT) {
return HAL_TIMEOUT;
}
} while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U);
After comparing header files between FW_F7 v1.17.1 and FW_F7 v1.17.4, I found that the macro:
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE()
is missing from stm32f7xx_hal_rcc_ex.h in the new version.
Previously, it was defined as:
#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN); \
tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN); \
UNUSED(tmpreg); \
} while(0)
Now, this definition is completely gone, so CubeMX can’t generate the call and the USB HS peripheral never receives its ULPI clock.
CubeMX should still generate both:
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
The missing macro should exist in the HAL headers as in previous firmware versions.
MCU: STM32F723IEK
CubeMX: v6.13.0
STM32Cube FW_F7: v1.17.4
USB Configuration: High Speed (ULPI PHY) / CDC
Could you please confirm:
Whether the removal of __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() is intentional,
If not, when it will be restored in a future release of the F7 HAL,
Or if there’s a new equivalent macro/API that should now be used instead?
2025-09-29 9:44 AM
Hello @CObri.1
This should be fixed in the latest release of STM32CubeMx.
Please update and use latest release v6.15. Then, keep us informed about your progress on this.