@@ -322,7 +322,11 @@ WEAK void SystemClock_Config(void)
322
322
__HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE0);
323
323
324
324
while (!__HAL_PWR_GET_FLAG (PWR_FLAG_VOSRDY)) {}
325
- /* Initializes the CPU, AHB and APB busses clocks */
325
+ /* Macro to configure the PLL clock source */
326
+ __HAL_RCC_PLL_PLLSOURCE_CONFIG (RCC_PLLSOURCE_HSE);
327
+ /* * Initializes the RCC Oscillators according to the specified parameters
328
+ * in the RCC_OscInitTypeDef structure.
329
+ */
326
330
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE;
327
331
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
328
332
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
@@ -331,15 +335,15 @@ WEAK void SystemClock_Config(void)
331
335
RCC_OscInitStruct.PLL .PLLM = 1 ;
332
336
RCC_OscInitStruct.PLL .PLLN = 120 ;
333
337
RCC_OscInitStruct.PLL .PLLP = 2 ;
334
- RCC_OscInitStruct.PLL .PLLQ = 2 ;
338
+ RCC_OscInitStruct.PLL .PLLQ = 8 ;
335
339
RCC_OscInitStruct.PLL .PLLR = 2 ;
336
340
RCC_OscInitStruct.PLL .PLLRGE = RCC_PLL1VCIRANGE_3;
337
341
RCC_OscInitStruct.PLL .PLLVCOSEL = RCC_PLL1VCOWIDE;
338
342
RCC_OscInitStruct.PLL .PLLFRACN = 0 ;
339
343
if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK) {
340
344
Error_Handler ();
341
345
}
342
- /* Initializes the CPU, AHB and APB busses clocks */
346
+ /* Initializes the CPU, AHB and APB buses clocks */
343
347
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
344
348
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2
345
349
| RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1;
@@ -355,24 +359,23 @@ WEAK void SystemClock_Config(void)
355
359
Error_Handler ();
356
360
}
357
361
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC
358
- | RCC_PERIPHCLK_USB | RCC_PERIPHCLK_QSPI;
362
+ | RCC_PERIPHCLK_USB | RCC_PERIPHCLK_QSPI
363
+ | RCC_PERIPHCLK_SDMMC;
359
364
PeriphClkInitStruct.PLL2 .PLL2M = 1 ;
360
365
PeriphClkInitStruct.PLL2 .PLL2N = 18 ;
361
- PeriphClkInitStruct.PLL2 .PLL2P = 1 ;
366
+ PeriphClkInitStruct.PLL2 .PLL2P = 2 ;
362
367
PeriphClkInitStruct.PLL2 .PLL2Q = 2 ;
363
368
PeriphClkInitStruct.PLL2 .PLL2R = 2 ;
364
369
PeriphClkInitStruct.PLL2 .PLL2RGE = RCC_PLL2VCIRANGE_3;
365
370
PeriphClkInitStruct.PLL2 .PLL2VCOSEL = RCC_PLL2VCOMEDIUM;
366
- PeriphClkInitStruct.PLL2 .PLL2FRACN = 6144 ;
371
+ PeriphClkInitStruct.PLL2 .PLL2FRACN = 6144.0 ;
367
372
PeriphClkInitStruct.QspiClockSelection = RCC_QSPICLKSOURCE_D1HCLK;
368
373
PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL;
369
374
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
370
375
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
371
376
if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK) {
372
377
Error_Handler ();
373
378
}
374
- /* Enable USB Voltage detector */
375
- HAL_PWREx_EnableUSBVoltageDetector ();
376
379
}
377
380
378
381
#ifdef __cplusplus
0 commit comments