@@ -63,7 +63,7 @@ extern "C" {
63
63
64
64
/* *
65
65
* @brief System Clock Configuration
66
- * The system Clock is configured as follow :
66
+ * The system Clock is configured as follow :
67
67
* System Clock source = PLL (HSE)
68
68
* SYSCLK(Hz) = 216000000
69
69
* HCLK(Hz) = 216000000
@@ -89,16 +89,14 @@ WEAK void SystemClock_Config(void)
89
89
RCC_ClkInitTypeDef RCC_ClkInitStruct;
90
90
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
91
91
92
- /* *Configure the main internal regulator output voltage
93
- */
92
+ /* Configure the main internal regulator output voltage */
94
93
__HAL_RCC_PWR_CLK_ENABLE ();
95
94
96
95
__HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
97
96
98
- /* *Initializes the CPU, AHB and APB busses clocks
99
- */
97
+ /* Initializes the CPU, AHB and APB busses clocks */
100
98
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
101
- RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS ;
99
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON ;
102
100
RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
103
101
RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE;
104
102
RCC_OscInitStruct.PLL .PLLM = 25 ;
@@ -107,18 +105,16 @@ WEAK void SystemClock_Config(void)
107
105
RCC_OscInitStruct.PLL .PLLQ = 9 ;
108
106
if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK)
109
107
{
110
- while ( 1 ) { ; }
108
+ _Error_Handler (__FILE__, __LINE__);
111
109
}
112
110
113
- /* *Activate the Over-Drive mode
114
- */
111
+ /* Activate the Over-Drive mode */
115
112
if (HAL_PWREx_EnableOverDrive () != HAL_OK)
116
113
{
117
- while ( 1 ) { ; }
114
+ _Error_Handler (__FILE__, __LINE__);
118
115
}
119
116
120
- /* *Initializes the CPU, AHB and APB busses clocks
121
- */
117
+ /* Initializes the CPU, AHB and APB busses clocks */
122
118
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
123
119
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
124
120
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
@@ -128,26 +124,28 @@ WEAK void SystemClock_Config(void)
128
124
129
125
if (HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
130
126
{
131
- while ( 1 ) { ; }
127
+ _Error_Handler (__FILE__, __LINE__);
132
128
}
133
129
134
130
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC|RCC_PERIPHCLK_USART1
135
131
|RCC_PERIPHCLK_CLK48;
136
132
PeriphClkInitStruct.PLLSAI .PLLSAIN = 192 ;
137
- PeriphClkInitStruct.PLLSAI .PLLSAIR = 2 ;
133
+ PeriphClkInitStruct.PLLSAI .PLLSAIR = 5 ;
138
134
PeriphClkInitStruct.PLLSAI .PLLSAIQ = 2 ;
139
135
PeriphClkInitStruct.PLLSAI .PLLSAIP = RCC_PLLSAIP_DIV4;
140
136
PeriphClkInitStruct.PLLSAIDivQ = 1 ;
141
- PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2 ;
137
+ PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4 ;
142
138
PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
143
- PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLLSAIP ;
139
+ PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLL ;
144
140
if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK)
145
141
{
146
- while ( 1 ) { ; }
142
+ _Error_Handler (__FILE__, __LINE__);
147
143
}
148
144
145
+ /* Configure the Systick interrupt time */
149
146
HAL_SYSTICK_Config (HAL_RCC_GetHCLKFreq ()/1000 );
150
147
148
+ /* Configure the Systick */
151
149
HAL_SYSTICK_CLKSourceConfig (SYSTICK_CLKSOURCE_HCLK);
152
150
153
151
/* SysTick_IRQn interrupt configuration */
0 commit comments