cancel
Showing results for 
Search instead for 
Did you mean: 

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

RWarh.1
Associate

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.

1 REPLY 1
Simon.T
ST Employee

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