File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G431xB Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
88
88
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0 };
89
89
RCC_PeriphCLKInitTypeDef RCC_PeriphCLKInitStruct = { 0 };
90
90
91
- #if HSE_VALUE != 24000000
91
+ #if HSE_VALUE != 4000000 && HSE_VALUE != 8000000 && HSE_VALUE != 16000000 && HSE_VALUE != 24000000
92
92
#error Unsupported externall clock value, check HSE_VALUE define
93
93
#endif
94
94
@@ -100,7 +100,16 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
100
100
RCC_OscInitStruct .HSEState = RCC_HSE_ON ;
101
101
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_ON ;
102
102
RCC_OscInitStruct .PLL .PLLSource = RCC_PLLSOURCE_HSE ;
103
+ #if HSE_VALUE == 4000000
104
+ RCC_OscInitStruct .PLL .PLLM = RCC_PLLM_DIV1 ;
105
+ #elif HSE_VALUE == 8000000
106
+ RCC_OscInitStruct .PLL .PLLM = RCC_PLLM_DIV2 ;
107
+ #elif HSE_VALUE == 16000000
108
+ RCC_OscInitStruct .PLL .PLLM = RCC_PLLM_DIV4 ;
109
+ #elif HSE_VALUE == 24000000
103
110
RCC_OscInitStruct .PLL .PLLM = RCC_PLLM_DIV6 ;
111
+ #endif
112
+
104
113
//! 170MHz as a core frequency for FDCAN is not suitable for many frequencies,
105
114
//! as it provides low accuracy. When no FDCAN is used, the full capacity of 170 MHz
106
115
//! should be standard.
You can’t perform that action at this time.
0 commit comments