@@ -182,13 +182,9 @@ WEAK void SystemClock_Config(void)
182
182
/* * Initializes the RCC Oscillators according to the specified parameters
183
183
* in the RCC_OscInitTypeDef structure.
184
184
*/
185
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE
186
- | RCC_OSCILLATORTYPE_LSE;
187
- RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS_DIGITAL;
185
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
186
+ RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
188
187
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
189
- RCC_OscInitStruct.HSIState = RCC_HSI_ON;
190
- RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
191
- RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
192
188
RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
193
189
RCC_OscInitStruct.PLL .PLLSource = RCC_PLL1_SOURCE_HSE;
194
190
RCC_OscInitStruct.PLL .PLLM = 4 ;
@@ -199,6 +195,7 @@ WEAK void SystemClock_Config(void)
199
195
RCC_OscInitStruct.PLL .PLLRGE = RCC_PLL1_VCIRANGE_1;
200
196
RCC_OscInitStruct.PLL .PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE;
201
197
RCC_OscInitStruct.PLL .PLLFRACN = 0 ;
198
+
202
199
if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK) {
203
200
Error_Handler ();
204
201
}
@@ -221,22 +218,26 @@ WEAK void SystemClock_Config(void)
221
218
/* * Initializes the peripherals clock
222
219
*/
223
220
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADCDAC | RCC_PERIPHCLK_LPUART1
224
- | RCC_PERIPHCLK_OSPI | RCC_PERIPHCLK_SDMMC1
225
221
| RCC_PERIPHCLK_USB;
226
- PeriphClkInitStruct.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_HCLK;
222
+ PeriphClkInitStruct.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_PLL2R;
223
+ PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK3;
224
+ PeriphClkInitStruct.OspiClockSelection = RCC_OSPICLKSOURCE_HCLK;
225
+ PeriphClkInitStruct.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLL1Q;
226
+ PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL3Q;
227
+
227
228
PeriphClkInitStruct.PLL2 .PLL2Source = RCC_PLL2_SOURCE_HSE;
228
229
PeriphClkInitStruct.PLL2 .PLL2M = 2 ;
229
- PeriphClkInitStruct.PLL2 .PLL2N = 128 ;
230
+ PeriphClkInitStruct.PLL2 .PLL2N = 125 ;
230
231
PeriphClkInitStruct.PLL2 .PLL2P = 2 ;
231
- PeriphClkInitStruct.PLL2 .PLL2Q = 16 ;
232
- PeriphClkInitStruct.PLL2 .PLL2R = 2 ;
232
+ PeriphClkInitStruct.PLL2 .PLL2Q = 15 ;
233
+ PeriphClkInitStruct.PLL2 .PLL2R = 4 ;
233
234
PeriphClkInitStruct.PLL2 .PLL2RGE = RCC_PLL2_VCIRANGE_2;
234
235
PeriphClkInitStruct.PLL2 .PLL2VCOSEL = RCC_PLL2_VCORANGE_WIDE;
235
236
PeriphClkInitStruct.PLL2 .PLL2FRACN = 0 ;
236
- PeriphClkInitStruct.PLL2 .PLL2ClockOut = RCC_PLL2_DIVQ;
237
+ PeriphClkInitStruct.PLL2 .PLL2ClockOut = RCC_PLL2_DIVQ | RCC_PLL2_DIVR ;
237
238
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2Q;
238
- PeriphClkInitStruct.OspiClockSelection = RCC_OSPICLKSOURCE_HCLK ;
239
- PeriphClkInitStruct. Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLL1Q;
239
+ PeriphClkInitStruct.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_PLL2R ;
240
+
240
241
PeriphClkInitStruct.PLL3 .PLL3Source = RCC_PLL3_SOURCE_HSE;
241
242
PeriphClkInitStruct.PLL3 .PLL3M = 2 ;
242
243
PeriphClkInitStruct.PLL3 .PLL3N = 96 ;
@@ -248,6 +249,7 @@ WEAK void SystemClock_Config(void)
248
249
PeriphClkInitStruct.PLL3 .PLL3FRACN = 0 ;
249
250
PeriphClkInitStruct.PLL3 .PLL3ClockOut = RCC_PLL3_DIVQ;
250
251
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL3Q;
252
+
251
253
if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK) {
252
254
Error_Handler ();
253
255
}
0 commit comments