cancel
Showing results for 
Search instead for 
Did you mean: 

Missing ULPI clock enable macro and USB HS initialization failure after update to CubeMX v6.13.0 / FW_F7 v1.17.4

CObri.1
Associate III

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.

Observed behavior

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);

 

Root cause investigation

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.

 

Expected behavior

  • CubeMX should still generate both:

__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();

 

when USB_HS with ULPI PHY is selected.
  • The missing macro should exist in the HAL headers as in previous firmware versions.

 

 

Environment

  • MCU: STM32F723IEK

  • CubeMX: v6.13.0

  • STM32Cube FW_F7: v1.17.4

  • USB Configuration: High Speed (ULPI PHY) / CDC

 

 

Request

Could you please confirm:

  1. Whether the removal of __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() is intentional,

  2. If not, when it will be restored in a future release of the F7 HAL,

  3. Or if there’s a new equivalent macro/API that should now be used instead?

1 REPLY 1
Imen.D
ST Employee

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.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen