4
4
* @author MCD Application Team
5
5
* @brief CMSIS Cortex-M7 Device Peripheral Access Layer System Source File.
6
6
*
7
- * This file provides two functions and one global variable to be called from
7
+ * This file provides two functions and one global variable to be called from
8
8
* user application:
9
- * - SystemInit(): This function is called at startup just after reset and
9
+ * - SystemInit(): This function is called at startup just after reset and
10
10
* before branch to main program. This call is made inside
11
11
* the "startup_stm32f7xx.s" file.
12
12
*
13
13
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
14
- * by the user application to setup the SysTick
14
+ * by the user application to setup the SysTick
15
15
* timer or configure other parameters.
16
- *
16
+ *
17
17
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
18
18
* be called whenever the core clock is changed
19
19
* during program execution.
38
38
39
39
/** @addtogroup stm32f7xx_system
40
40
* @{
41
- */
42
-
41
+ */
42
+
43
43
/** @addtogroup STM32F7xx_System_Private_Includes
44
44
* @{
45
45
*/
65
65
/************************* Miscellaneous Configuration ************************/
66
66
/* Note: Following vector table addresses must be defined in line with linker
67
67
configuration. */
68
-
69
68
/*!< Uncomment the following line and change the address
70
69
if you need to relocate your vector Table at a custom base address (+ VECT_TAB_OFFSET) */
71
70
/* #define VECT_TAB_BASE_ADDRESS 0x08000000 */
72
71
73
72
/*!< Uncomment the following line if you need to relocate your vector Table
74
- in Sram else user remap will be done by default in Flash. */
73
+ in Sram else user remap will be done in Flash. */
75
74
/* #define VECT_TAB_SRAM */
76
75
77
76
#ifndef VECT_TAB_OFFSET
110
109
/* This variable is updated in three ways:
111
110
1) by calling CMSIS function SystemCoreClockUpdate()
112
111
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
113
- 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
112
+ 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
114
113
Note: If you use this function to configure the system clock; then there
115
114
is no need to call the 2 first functions listed above, since SystemCoreClock
116
115
variable is updated automatically.
137
136
138
137
/**
139
138
* @brief Setup the microcontroller system
140
- * Initialize the Embedded Flash Interface, the PLL and update the
139
+ * Initialize the Embedded Flash Interface, the PLL and update the
141
140
* SystemFrequency variable.
142
141
* @param None
143
142
* @retval None
@@ -177,41 +176,41 @@ void SystemInit(void)
177
176
* The SystemCoreClock variable contains the core clock (HCLK), it can
178
177
* be used by the user application to setup the SysTick timer or configure
179
178
* other parameters.
180
- *
179
+ *
181
180
* @note Each time the core clock (HCLK) changes, this function must be called
182
181
* to update SystemCoreClock variable value. Otherwise, any configuration
183
- * based on this variable will be incorrect.
184
- *
185
- * @note - The system frequency computed by this function is not the real
186
- * frequency in the chip. It is calculated based on the predefined
182
+ * based on this variable will be incorrect.
183
+ *
184
+ * @note - The system frequency computed by this function is not the real
185
+ * frequency in the chip. It is calculated based on the predefined
187
186
* constant and the selected clock source:
188
- *
187
+ *
189
188
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
190
- *
189
+ *
191
190
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
192
- *
193
- * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
191
+ *
192
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
194
193
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
195
- *
194
+ *
196
195
* (*) HSI_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
197
196
* 16 MHz) but the real value may vary depending on the variations
198
- * in voltage and temperature.
199
- *
197
+ * in voltage and temperature.
198
+ *
200
199
* (**) HSE_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
201
200
* 25 MHz), user has to ensure that HSE_VALUE is same as the real
202
201
* frequency of the crystal used. Otherwise, this function may
203
202
* have wrong result.
204
- *
203
+ *
205
204
* - The result of this function could be not correct when using fractional
206
205
* value for HSE crystal.
207
- *
206
+ *
208
207
* @param None
209
208
* @retval None
210
209
*/
211
210
void SystemCoreClockUpdate (void )
212
211
{
213
- uint32_t tmp = 0 , pllvco = 0 , pllp = 2 , pllsource = 0 , pllm = 2 ;
214
-
212
+ uint32_t tmp , pllvco , pllp , pllsource , pllm ;
213
+
215
214
/* Get SYSCLK source -------------------------------------------------------*/
216
215
tmp = RCC -> CFGR & RCC_CFGR_SWS ;
217
216
@@ -227,10 +226,10 @@ void SystemCoreClockUpdate(void)
227
226
228
227
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
229
228
SYSCLK = PLL_VCO / PLL_P
230
- */
229
+ */
231
230
pllsource = (RCC -> PLLCFGR & RCC_PLLCFGR_PLLSRC ) >> 22 ;
232
231
pllm = RCC -> PLLCFGR & RCC_PLLCFGR_PLLM ;
233
-
232
+
234
233
if (pllsource != 0 )
235
234
{
236
235
/* HSE used as PLL clock source */
@@ -239,7 +238,7 @@ void SystemCoreClockUpdate(void)
239
238
else
240
239
{
241
240
/* HSI used as PLL clock source */
242
- pllvco = (HSI_VALUE / pllm ) * ((RCC -> PLLCFGR & RCC_PLLCFGR_PLLN ) >> 6 );
241
+ pllvco = (HSI_VALUE / pllm ) * ((RCC -> PLLCFGR & RCC_PLLCFGR_PLLN ) >> 6 );
243
242
}
244
243
245
244
pllp = (((RCC -> PLLCFGR & RCC_PLLCFGR_PLLP ) >>16 ) + 1 ) * 2 ;
@@ -263,7 +262,7 @@ void SystemCoreClockUpdate(void)
263
262
/**
264
263
* @}
265
264
*/
266
-
265
+
267
266
/**
268
267
* @}
269
- */
268
+ */
0 commit comments