44 * @author MCD Application Team
55 * @brief CMSIS Cortex-M7 Device Peripheral Access Layer System Source File.
66 *
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
88 * 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
1010 * before branch to main program. This call is made inside
1111 * the "startup_stm32f7xx.s" file.
1212 *
1313 * - 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
1515 * timer or configure other parameters.
16- *
16+ *
1717 * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
1818 * be called whenever the core clock is changed
1919 * during program execution.
3838
3939/** @addtogroup stm32f7xx_system
4040 * @{
41- */
42-
41+ */
42+
4343/** @addtogroup STM32F7xx_System_Private_Includes
4444 * @{
4545 */
6565/************************* Miscellaneous Configuration ************************/
6666/* Note: Following vector table addresses must be defined in line with linker
6767 configuration. */
68-
6968/*!< Uncomment the following line and change the address
7069 if you need to relocate your vector Table at a custom base address (+ VECT_TAB_OFFSET) */
7170/* #define VECT_TAB_BASE_ADDRESS 0x08000000 */
7271
7372/*!< 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. */
7574/* #define VECT_TAB_SRAM */
7675
7776#ifndef VECT_TAB_OFFSET
110109 /* This variable is updated in three ways:
111110 1) by calling CMSIS function SystemCoreClockUpdate()
112111 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
114113 Note: If you use this function to configure the system clock; then there
115114 is no need to call the 2 first functions listed above, since SystemCoreClock
116115 variable is updated automatically.
137136
138137/**
139138 * @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
141140 * SystemFrequency variable.
142141 * @param None
143142 * @retval None
@@ -177,41 +176,41 @@ void SystemInit(void)
177176 * The SystemCoreClock variable contains the core clock (HCLK), it can
178177 * be used by the user application to setup the SysTick timer or configure
179178 * other parameters.
180- *
179+ *
181180 * @note Each time the core clock (HCLK) changes, this function must be called
182181 * 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
187186 * constant and the selected clock source:
188- *
187+ *
189188 * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
190- *
189+ *
191190 * - 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(**)
194193 * or HSI_VALUE(*) multiplied/divided by the PLL factors.
195- *
194+ *
196195 * (*) HSI_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
197196 * 16 MHz) but the real value may vary depending on the variations
198- * in voltage and temperature.
199- *
197+ * in voltage and temperature.
198+ *
200199 * (**) HSE_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
201200 * 25 MHz), user has to ensure that HSE_VALUE is same as the real
202201 * frequency of the crystal used. Otherwise, this function may
203202 * have wrong result.
204- *
203+ *
205204 * - The result of this function could be not correct when using fractional
206205 * value for HSE crystal.
207- *
206+ *
208207 * @param None
209208 * @retval None
210209 */
211210void SystemCoreClockUpdate (void )
212211{
213- uint32_t tmp = 0 , pllvco = 0 , pllp = 2 , pllsource = 0 , pllm = 2 ;
214-
212+ uint32_t tmp , pllvco , pllp , pllsource , pllm ;
213+
215214 /* Get SYSCLK source -------------------------------------------------------*/
216215 tmp = RCC -> CFGR & RCC_CFGR_SWS ;
217216
@@ -227,10 +226,10 @@ void SystemCoreClockUpdate(void)
227226
228227 /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
229228 SYSCLK = PLL_VCO / PLL_P
230- */
229+ */
231230 pllsource = (RCC -> PLLCFGR & RCC_PLLCFGR_PLLSRC ) >> 22 ;
232231 pllm = RCC -> PLLCFGR & RCC_PLLCFGR_PLLM ;
233-
232+
234233 if (pllsource != 0 )
235234 {
236235 /* HSE used as PLL clock source */
@@ -239,7 +238,7 @@ void SystemCoreClockUpdate(void)
239238 else
240239 {
241240 /* 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 );
243242 }
244243
245244 pllp = (((RCC -> PLLCFGR & RCC_PLLCFGR_PLLP ) >>16 ) + 1 ) * 2 ;
@@ -263,7 +262,7 @@ void SystemCoreClockUpdate(void)
263262/**
264263 * @}
265264 */
266-
265+
267266/**
268267 * @}
269- */
268+ */
0 commit comments