cancel
Showing results for 
Search instead for 
Did you mean: 

USB HS clocks not started from CubeMX 6.13 onwards

LucaP
Associate II

I am using the STM32F723 with custom, self-powered PCB interfaced to a host using USB HS. Everything worked fine with with CubeMX 6.12, but after upgrading to more recent versions, I noticed that the following functions are no longer generated within HAL_PCD_MspInit() (file usbd_conf.c):    

 

__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
 
and also the corresponding clock-disabling functions in HAL_PCD_MspDeInit(). If I manually re-insert these calls, everything works again.
Anyone knows the reason why these functions are not generated, and if I am missing any USB_HS setting in more recent CubeMX versions that should be taking care of this issue? Thanks!
1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hi @LucaP 

Thank you for reporting and reproducing with latest version.

The issue is reported to dedicated team for a fix in code generation. Ticket number 204861 for reference.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


View solution in original post

7 REPLIES 7
TDK
Guru

Include the IOC that you think is generating faulty code.

If you feel a post has answered your question, please click "Accept as Solution".
FBL
ST Employee

Hi @LucaP 

Try to reproduce with latest version V6.14 first.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


LucaP
Associate II

Hello @FBL ,

I have tried migrating the IOC from 6.12.1 to 6.13 and then to 6.14, also from 6.12.1 directly to 6.14, but in all cases those functions are no longer generated by CubeMX.

Anything else I should try? 

LucaP
Associate II

Sorry for missing your request....attached are IOC projects created from scratch with CubeMX 6.12 and 6.14 respectively, based on the same MCU with only a HS USB and CDC activated. As you can see, usbd_conf.c generated by 6.12 calls the functions above, while the 6.14 does not.

From CubeMX 6.12:

 

    __HAL_RCC_GPIOB_CLK_ENABLE();
    /**USB_OTG_HS GPIO Configuration
    PB13     ------> USB_OTG_HS_VBUS
    PB14     ------> USB_OTG_HS_DM
    PB15     ------> USB_OTG_HS_DP
    */
    GPIO_InitStruct.Pin = GPIO_PIN_13;
    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    /* Peripheral clock enable */
    __HAL_RCC_OTGPHYC_CLK_ENABLE();
    __HAL_RCC_USB_OTG_HS_CLK_ENABLE();
    __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();

    /* Peripheral interrupt init */
    HAL_NVIC_SetPriority(OTG_HS_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(OTG_HS_IRQn);

 

  vs. 6.14

 

    __HAL_RCC_GPIOB_CLK_ENABLE();
    /**USB_OTG_HS GPIO Configuration
    PB13     ------> USB_OTG_HS_VBUS
    PB14     ------> USB_OTG_HS_DM
    PB15     ------> USB_OTG_HS_DP
    */
    GPIO_InitStruct.Pin = GPIO_PIN_13;
    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    /* Peripheral clock enable */
    __HAL_RCC_OTGPHYC_CLK_ENABLE();

    /* Peripheral interrupt init */
    HAL_NVIC_SetPriority(OTG_HS_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(OTG_HS_IRQn);

 

 

LucaP
Associate II

Done, please see reply to @TDK above.

FBL
ST Employee

Hi @LucaP 

Thank you for reporting and reproducing with latest version.

The issue is reported to dedicated team for a fix in code generation. Ticket number 204861 for reference.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


LucaP
Associate II

Thank you, @FBL 

In these cases, would a fix be typically released in a major release like CubeMX 6.15, or a minor release sooner?