@@ -66,13 +66,15 @@ WEAK void SystemClock_Config(void)
66
66
/* HSE is available but SB9 and SB10 OFF so not usable per default */
67
67
RCC_OscInitTypeDef RCC_OscInitStruct = {};
68
68
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
69
+ RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
69
70
70
71
/* Configure the main internal regulator output voltage */
71
72
HAL_PWREx_ControlVoltageScaling (PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
72
73
/* Initializes the CPU, AHB and APB busses clocks */
73
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
74
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48 ;
74
75
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
75
76
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
77
+ RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
76
78
RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
77
79
RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSI;
78
80
RCC_OscInitStruct.PLL .PLLM = RCC_PLLM_DIV4;
@@ -94,10 +96,17 @@ WEAK void SystemClock_Config(void)
94
96
if (HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_8) != HAL_OK) {
95
97
Error_Handler ();
96
98
}
99
+ /* Initializes the peripherals clocks */
100
+ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USB;
101
+ PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_HSI;
102
+ PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
103
+ if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInit) != HAL_OK) {
104
+ Error_Handler ();
105
+ }
97
106
}
98
107
99
108
#ifdef __cplusplus
100
109
} // extern "C"
101
110
#endif
102
111
103
- #endif /* ARDUINO_NUCLEO_G431KB */
112
+ #endif /* ARDUINO_NUCLEO_G431KB */
0 commit comments