@@ -98,6 +98,7 @@ WEAK void SystemClock_Config(void)
9898 RCC_OscInitTypeDef RCC_OscInitStruct = {};
9999 RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
100100#ifdef USBCON
101+ RCC_CRSInitTypeDef RCC_CRSInitStruct = {};
101102 RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
102103#endif
103104
@@ -111,7 +112,7 @@ WEAK void SystemClock_Config(void)
111112 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
112113 RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
113114 RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
114- RCC_OscInitStruct.PLL .PLLM =RCC_PLLM_DIV4 ;
115+ RCC_OscInitStruct.PLL .PLLM =RCC_PLLM_DIV2 ;
115116 RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE;
116117 RCC_OscInitStruct.PLL .PLLN =85 ;
117118 RCC_OscInitStruct.PLL .PLLP = RCC_PLLP_DIV2;
@@ -133,6 +134,19 @@ WEAK void SystemClock_Config(void)
133134 }
134135
135136#ifdef USBCON
137+ /* Enable the SYSCFG APB clock*/
138+ __HAL_RCC_CRS_CLK_ENABLE ();
139+
140+ /* Configures CRS*/
141+ RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
142+ RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;
143+ RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
144+ RCC_CRSInitStruct.ReloadValue =__HAL_RCC_CRS_RELOADVALUE_CALCULATE (48000000 ,1000 );
145+ RCC_CRSInitStruct.ErrorLimitValue = RCC_CRS_ERRORLIMIT_DEFAULT;
146+ RCC_CRSInitStruct.HSI48CalibrationValue = RCC_CRS_HSI48CALIBRATION_DEFAULT;
147+
148+ HAL_RCCEx_CRSConfig (&RCC_CRSInitStruct);
149+
136150/* Initializes the peripherals clocks*/
137151 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
138152 PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
@@ -146,4 +160,4 @@ WEAK void SystemClock_Config(void)
146160}// extern "C"
147161#endif
148162
149- #endif/* ARDUINO_NUCLEO_G431RB */
163+ #endif/* ARDUINO_WEACT_G474CE */