@@ -103,18 +103,17 @@ extern "C" {
103
103
/* *
104
104
* @brief System Clock Configuration
105
105
* The system Clock is configured as follow :
106
- * System Clock source = PLL (HSE )
107
- * SYSCLK(Hz) = 96000000
108
- * HCLK(Hz) = 96000000
106
+ * System Clock source = PLL (HSI )
107
+ * SYSCLK(Hz) = 10000000
108
+ * HCLK(Hz) = 10000000
109
109
* AHB Prescaler = 1
110
110
* APB1 Prescaler = 2
111
111
* APB2 Prescaler = 1
112
- * HSE Frequency(Hz) = 8000000
113
112
* HSI Frequency(Hz) = 16000000
114
113
* PLL_M = 8
115
- * PLL_N = 384
114
+ * PLL_N = 100
116
115
* PLL_P = 4
117
- * PLL_Q = 8
116
+ * PLL_Q = 2
118
117
* VDD(V) = 3.3
119
118
* Main regulator output voltage = Scale1 mode
120
119
* Flash Latency(WS) = 3
@@ -127,31 +126,28 @@ WEAK void SystemClock_Config(void)
127
126
RCC_ClkInitTypeDef RCC_ClkInitStruct;
128
127
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
129
128
130
- /* *Configure the main internal regulator output voltage
131
- */
129
+ /* Configure the main internal regulator output voltage */
132
130
__HAL_RCC_PWR_CLK_ENABLE ();
133
131
134
132
__HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
135
133
136
- /* * Initializes the CPU, AHB and APB busses clocks
137
- */
138
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE ;
139
- RCC_OscInitStruct.HSEState = RCC_HSE_ON ;
140
- RCC_OscInitStruct.LSIState = RCC_LSI_ON ;
134
+ /* Initializes the CPU, AHB and APB busses clocks */
135
+ RCC_OscInitStruct. OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSE;
136
+ RCC_OscInitStruct.LSEState = RCC_LSE_ON ;
137
+ RCC_OscInitStruct.HSIState = RCC_HSI_ON ;
138
+ RCC_OscInitStruct.HSICalibrationValue = 16 ;
141
139
RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
142
- RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE ;
140
+ RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSI ;
143
141
RCC_OscInitStruct.PLL .PLLM = 8 ;
144
- RCC_OscInitStruct.PLL .PLLN = 384 ;
145
- RCC_OscInitStruct.PLL .PLLP = RCC_PLLP_DIV4 ;
146
- RCC_OscInitStruct.PLL .PLLQ = 8 ;
142
+ RCC_OscInitStruct.PLL .PLLN = 100 ;
143
+ RCC_OscInitStruct.PLL .PLLP = RCC_PLLP_DIV2 ;
144
+ RCC_OscInitStruct.PLL .PLLQ = 4 ;
147
145
if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK)
148
146
{
149
- /* Initialization Error */
150
- while (1 );
147
+ _Error_Handler (__FILE__, __LINE__);
151
148
}
152
149
153
- /* *Initializes the CPU, AHB and APB busses clocks
154
- */
150
+ /* Initializes the CPU, AHB and APB busses clocks */
155
151
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
156
152
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
157
153
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
@@ -161,31 +157,25 @@ WEAK void SystemClock_Config(void)
161
157
162
158
if (HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
163
159
{
164
- /* Initialization Error */
165
- while (1 );
160
+ _Error_Handler (__FILE__, __LINE__);
166
161
}
167
162
168
- PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S|RCC_PERIPHCLK_RTC;
169
- PeriphClkInitStruct.PLLI2S .PLLI2SN = 192 ;
170
- PeriphClkInitStruct.PLLI2S .PLLI2SM = 8 ;
171
- PeriphClkInitStruct.PLLI2S .PLLI2SR = 2 ;
172
- PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
163
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
164
+ PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
173
165
if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK)
174
166
{
175
- /* Initialization Error */
176
- while (1 );
167
+ _Error_Handler (__FILE__, __LINE__);
177
168
}
178
169
179
- /* *Configure the Systick interrupt time
180
- */
170
+ /* Configure the Systick interrupt time */
181
171
HAL_SYSTICK_Config (HAL_RCC_GetHCLKFreq ()/1000 );
182
172
183
- /* *Configure the Systick
184
- */
173
+ /* Configure the Systick */
185
174
HAL_SYSTICK_CLKSourceConfig (SYSTICK_CLKSOURCE_HCLK);
186
175
187
176
/* SysTick_IRQn interrupt configuration */
188
177
HAL_NVIC_SetPriority (SysTick_IRQn, 0 , 0 );
178
+
189
179
}
190
180
#ifdef __cplusplus
191
181
}
0 commit comments