@@ -63,7 +63,7 @@ extern "C" {
6363
6464/* *
6565 * @brief System Clock Configuration
66- * The system Clock is configured as follow :
66+ * The system Clock is configured as follow :
6767 * System Clock source = PLL (HSE)
6868 * SYSCLK(Hz) = 216000000
6969 * HCLK(Hz) = 216000000
@@ -89,16 +89,14 @@ WEAK void SystemClock_Config(void)
8989 RCC_ClkInitTypeDef RCC_ClkInitStruct;
9090 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
9191
92- /* *Configure the main internal regulator output voltage
93- */
92+ /* Configure the main internal regulator output voltage */
9493 __HAL_RCC_PWR_CLK_ENABLE ();
9594
9695 __HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
9796
98- /* *Initializes the CPU, AHB and APB busses clocks
99- */
97+ /* Initializes the CPU, AHB and APB busses clocks */
10098 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
101- RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS ;
99+ RCC_OscInitStruct.HSEState = RCC_HSE_ON ;
102100 RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
103101 RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE;
104102 RCC_OscInitStruct.PLL .PLLM = 25 ;
@@ -107,18 +105,16 @@ WEAK void SystemClock_Config(void)
107105 RCC_OscInitStruct.PLL .PLLQ = 9 ;
108106 if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK)
109107 {
110- while ( 1 ) { ; }
108+ _Error_Handler (__FILE__, __LINE__);
111109 }
112110
113- /* *Activate the Over-Drive mode
114- */
111+ /* Activate the Over-Drive mode */
115112 if (HAL_PWREx_EnableOverDrive () != HAL_OK)
116113 {
117- while ( 1 ) { ; }
114+ _Error_Handler (__FILE__, __LINE__);
118115 }
119116
120- /* *Initializes the CPU, AHB and APB busses clocks
121- */
117+ /* Initializes the CPU, AHB and APB busses clocks */
122118 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
123119 |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
124120 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
@@ -128,26 +124,28 @@ WEAK void SystemClock_Config(void)
128124
129125 if (HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
130126 {
131- while ( 1 ) { ; }
127+ _Error_Handler (__FILE__, __LINE__);
132128 }
133129
134130 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC|RCC_PERIPHCLK_USART1
135131 |RCC_PERIPHCLK_CLK48;
136132 PeriphClkInitStruct.PLLSAI .PLLSAIN = 192 ;
137- PeriphClkInitStruct.PLLSAI .PLLSAIR = 2 ;
133+ PeriphClkInitStruct.PLLSAI .PLLSAIR = 5 ;
138134 PeriphClkInitStruct.PLLSAI .PLLSAIQ = 2 ;
139135 PeriphClkInitStruct.PLLSAI .PLLSAIP = RCC_PLLSAIP_DIV4;
140136 PeriphClkInitStruct.PLLSAIDivQ = 1 ;
141- PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2 ;
137+ PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4 ;
142138 PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
143139 PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLLSAIP;
144140 if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK)
145141 {
146- while ( 1 ) { ; }
142+ _Error_Handler (__FILE__, __LINE__);
147143 }
148144
145+ /* Configure the Systick interrupt time */
149146 HAL_SYSTICK_Config (HAL_RCC_GetHCLKFreq ()/1000 );
150147
148+ /* Configure the Systick */
151149 HAL_SYSTICK_CLKSourceConfig (SYSTICK_CLKSOURCE_HCLK);
152150
153151 /* SysTick_IRQn interrupt configuration */
0 commit comments