Skip to main content
RWarh.1
Visitor II
Sep 20, 2022 12:03 PM UTC
Question

Missing initialiser for PLLQ USB clock source in code generated by CubeMX

CubeMX version: v6.6.1 MacOS

MCU: STM32G0B1CCUx

Issue:

When selecting PLLQ driven from HSE in USB Clock Mux in CubeMX and choosing LL as RCC driver, the clock source for USB is never actually set in the generated code.

This line is missing in the SystemClock_Config function:

LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLL);

When selecting HSI48 as USB clock source, this explicit setter is not necessary for some reason.

This topic has been closed for replies.

1 reply

Simon.T
ST Employee
Sep 27, 2022 3:36 PM UTC

Hello @RWarh.1​ ,

Have you check in the stm32g0xx_hal_msp.c ?

There should be a function named void HAL_HCD_MspInit(HCD_HandleTypeDef* hhcd) with this function inside :

LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLL);

Best regards,

Simon