1*0561b2d8STREFOU Felix /**
2*0561b2d8STREFOU Felix ******************************************************************************
3*0561b2d8STREFOU Felix * @file system_stm32wbxx.c
4*0561b2d8STREFOU Felix * @author MCD Application Team
5*0561b2d8STREFOU Felix * @brief CMSIS Cortex Device Peripheral Access Layer System Source File
6*0561b2d8STREFOU Felix *
7*0561b2d8STREFOU Felix * This file provides two functions and one global variable to be called from
8*0561b2d8STREFOU Felix * user application:
9*0561b2d8STREFOU Felix * - SystemInit(): This function is called at startup just after reset and
10*0561b2d8STREFOU Felix * before branch to main program. This call is made inside
11*0561b2d8STREFOU Felix * the "startup_stm32wbxx.s" file.
12*0561b2d8STREFOU Felix *
13*0561b2d8STREFOU Felix * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
14*0561b2d8STREFOU Felix * by the user application to setup the SysTick
15*0561b2d8STREFOU Felix * timer or configure other parameters.
16*0561b2d8STREFOU Felix *
17*0561b2d8STREFOU Felix * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
18*0561b2d8STREFOU Felix * be called whenever the core clock is changed
19*0561b2d8STREFOU Felix * during program execution.
20*0561b2d8STREFOU Felix *
21*0561b2d8STREFOU Felix * After each device reset the MSI (4 MHz) is used as system clock source.
22*0561b2d8STREFOU Felix * Then SystemInit() function is called, in "startup_stm32wbxx.s" file, to
23*0561b2d8STREFOU Felix * configure the system clock before to branch to main program.
24*0561b2d8STREFOU Felix *
25*0561b2d8STREFOU Felix * This file configures the system clock as follows:
26*0561b2d8STREFOU Felix *=============================================================================
27*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
28*0561b2d8STREFOU Felix * System Clock source | MSI
29*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
30*0561b2d8STREFOU Felix * SYSCLK(Hz) | 4000000
31*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
32*0561b2d8STREFOU Felix * HCLK(Hz) | 4000000
33*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
34*0561b2d8STREFOU Felix * AHB Prescaler | 1
35*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
36*0561b2d8STREFOU Felix * APB1 Prescaler | 1
37*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
38*0561b2d8STREFOU Felix * APB2 Prescaler | 1
39*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
40*0561b2d8STREFOU Felix * PLL_M | 1
41*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
42*0561b2d8STREFOU Felix * PLL_N | 8
43*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
44*0561b2d8STREFOU Felix * PLL_P | 7
45*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
46*0561b2d8STREFOU Felix * PLL_Q | 2
47*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
48*0561b2d8STREFOU Felix * PLL_R | 2
49*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
50*0561b2d8STREFOU Felix * PLLSAI1_P | NA
51*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
52*0561b2d8STREFOU Felix * PLLSAI1_Q | NA
53*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
54*0561b2d8STREFOU Felix * PLLSAI1_R | NA
55*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
56*0561b2d8STREFOU Felix * Require 48MHz for USB OTG FS, | Disabled
57*0561b2d8STREFOU Felix * SDIO and RNG clock |
58*0561b2d8STREFOU Felix *-----------------------------------------------------------------------------
59*0561b2d8STREFOU Felix *=============================================================================
60*0561b2d8STREFOU Felix ******************************************************************************
61*0561b2d8STREFOU Felix * @attention
62*0561b2d8STREFOU Felix *
63*0561b2d8STREFOU Felix * <h2><center>© Copyright (c) 2019 STMicroelectronics.
64*0561b2d8STREFOU Felix * All rights reserved.</center></h2>
65*0561b2d8STREFOU Felix *
66*0561b2d8STREFOU Felix * This software component is licensed by ST under BSD 3-Clause license,
67*0561b2d8STREFOU Felix * the "License"; You may not use this file except in compliance with the
68*0561b2d8STREFOU Felix * License. You may obtain a copy of the License at:
69*0561b2d8STREFOU Felix * opensource.org/licenses/BSD-3-Clause
70*0561b2d8STREFOU Felix *
71*0561b2d8STREFOU Felix ******************************************************************************
72*0561b2d8STREFOU Felix */
73*0561b2d8STREFOU Felix
74*0561b2d8STREFOU Felix /** @addtogroup CMSIS
75*0561b2d8STREFOU Felix * @{
76*0561b2d8STREFOU Felix */
77*0561b2d8STREFOU Felix
78*0561b2d8STREFOU Felix /** @addtogroup stm32WBxx_system
79*0561b2d8STREFOU Felix * @{
80*0561b2d8STREFOU Felix */
81*0561b2d8STREFOU Felix
82*0561b2d8STREFOU Felix /** @addtogroup stm32WBxx_System_Private_Includes
83*0561b2d8STREFOU Felix * @{
84*0561b2d8STREFOU Felix */
85*0561b2d8STREFOU Felix
86*0561b2d8STREFOU Felix #include "stm32wbxx.h"
87*0561b2d8STREFOU Felix
88*0561b2d8STREFOU Felix #if !defined (HSE_VALUE)
89*0561b2d8STREFOU Felix #define HSE_VALUE (32000000UL) /*!< Value of the External oscillator in Hz */
90*0561b2d8STREFOU Felix #endif /* HSE_VALUE */
91*0561b2d8STREFOU Felix
92*0561b2d8STREFOU Felix #if !defined (MSI_VALUE)
93*0561b2d8STREFOU Felix #define MSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/
94*0561b2d8STREFOU Felix #endif /* MSI_VALUE */
95*0561b2d8STREFOU Felix
96*0561b2d8STREFOU Felix #if !defined (HSI_VALUE)
97*0561b2d8STREFOU Felix #define HSI_VALUE (16000000UL) /*!< Value of the Internal oscillator in Hz*/
98*0561b2d8STREFOU Felix #endif /* HSI_VALUE */
99*0561b2d8STREFOU Felix
100*0561b2d8STREFOU Felix #if !defined (LSI_VALUE)
101*0561b2d8STREFOU Felix #define LSI_VALUE (32000UL) /*!< Value of LSI in Hz*/
102*0561b2d8STREFOU Felix #endif /* LSI_VALUE */
103*0561b2d8STREFOU Felix
104*0561b2d8STREFOU Felix #if !defined (LSE_VALUE)
105*0561b2d8STREFOU Felix #define LSE_VALUE (32768UL) /*!< Value of LSE in Hz*/
106*0561b2d8STREFOU Felix #endif /* LSE_VALUE */
107*0561b2d8STREFOU Felix
108*0561b2d8STREFOU Felix /**
109*0561b2d8STREFOU Felix * @}
110*0561b2d8STREFOU Felix */
111*0561b2d8STREFOU Felix
112*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_TypesDefinitions
113*0561b2d8STREFOU Felix * @{
114*0561b2d8STREFOU Felix */
115*0561b2d8STREFOU Felix
116*0561b2d8STREFOU Felix /**
117*0561b2d8STREFOU Felix * @}
118*0561b2d8STREFOU Felix */
119*0561b2d8STREFOU Felix
120*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_Defines
121*0561b2d8STREFOU Felix * @{
122*0561b2d8STREFOU Felix */
123*0561b2d8STREFOU Felix
124*0561b2d8STREFOU Felix /*!< Uncomment the following line if you need to relocate your vector Table in
125*0561b2d8STREFOU Felix Internal SRAM. */
126*0561b2d8STREFOU Felix /* #define VECT_TAB_SRAM */
127*0561b2d8STREFOU Felix #define VECT_TAB_OFFSET 0x0U /*!< Vector Table base offset field.
128*0561b2d8STREFOU Felix This value must be a multiple of 0x200. */
129*0561b2d8STREFOU Felix
130*0561b2d8STREFOU Felix #define VECT_TAB_BASE_ADDRESS SRAM1_BASE /*!< Vector Table base offset field.
131*0561b2d8STREFOU Felix This value must be a multiple of 0x200. */
132*0561b2d8STREFOU Felix /**
133*0561b2d8STREFOU Felix * @}
134*0561b2d8STREFOU Felix */
135*0561b2d8STREFOU Felix
136*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_Macros
137*0561b2d8STREFOU Felix * @{
138*0561b2d8STREFOU Felix */
139*0561b2d8STREFOU Felix
140*0561b2d8STREFOU Felix /**
141*0561b2d8STREFOU Felix * @}
142*0561b2d8STREFOU Felix */
143*0561b2d8STREFOU Felix
144*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_Variables
145*0561b2d8STREFOU Felix * @{
146*0561b2d8STREFOU Felix */
147*0561b2d8STREFOU Felix /* The SystemCoreClock variable is updated in three ways:
148*0561b2d8STREFOU Felix 1) by calling CMSIS function SystemCoreClockUpdate()
149*0561b2d8STREFOU Felix 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
150*0561b2d8STREFOU Felix 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
151*0561b2d8STREFOU Felix Note: If you use this function to configure the system clock; then there
152*0561b2d8STREFOU Felix is no need to call the 2 first functions listed above, since SystemCoreClock
153*0561b2d8STREFOU Felix variable is updated automatically.
154*0561b2d8STREFOU Felix */
155*0561b2d8STREFOU Felix uint32_t SystemCoreClock = 4000000UL ; /*CPU1: M4 on MSI clock after startup (4MHz)*/
156*0561b2d8STREFOU Felix
157*0561b2d8STREFOU Felix const uint32_t AHBPrescTable[16UL] = {1UL, 3UL, 5UL, 1UL, 1UL, 6UL, 10UL, 32UL, 2UL, 4UL, 8UL, 16UL, 64UL, 128UL, 256UL, 512UL};
158*0561b2d8STREFOU Felix
159*0561b2d8STREFOU Felix const uint32_t APBPrescTable[8UL] = {0UL, 0UL, 0UL, 0UL, 1UL, 2UL, 3UL, 4UL};
160*0561b2d8STREFOU Felix
161*0561b2d8STREFOU Felix const uint32_t MSIRangeTable[16UL] = {100000UL, 200000UL, 400000UL, 800000UL, 1000000UL, 2000000UL, \
162*0561b2d8STREFOU Felix 4000000UL, 8000000UL, 16000000UL, 24000000UL, 32000000UL, 48000000UL, 0UL, 0UL, 0UL, 0UL}; /* 0UL values are incorrect cases */
163*0561b2d8STREFOU Felix
164*0561b2d8STREFOU Felix const uint32_t SmpsPrescalerTable[4UL][6UL]={{1UL,3UL,2UL,2UL,1UL,2UL}, \
165*0561b2d8STREFOU Felix {2UL,6UL,4UL,3UL,2UL,4UL}, \
166*0561b2d8STREFOU Felix {4UL,12UL,8UL,6UL,4UL,8UL}, \
167*0561b2d8STREFOU Felix {4UL,12UL,8UL,6UL,4UL,8UL}};
168*0561b2d8STREFOU Felix
169*0561b2d8STREFOU Felix /**
170*0561b2d8STREFOU Felix * @}
171*0561b2d8STREFOU Felix */
172*0561b2d8STREFOU Felix
173*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_FunctionPrototypes
174*0561b2d8STREFOU Felix * @{
175*0561b2d8STREFOU Felix */
176*0561b2d8STREFOU Felix
177*0561b2d8STREFOU Felix /**
178*0561b2d8STREFOU Felix * @}
179*0561b2d8STREFOU Felix */
180*0561b2d8STREFOU Felix
181*0561b2d8STREFOU Felix /** @addtogroup STM32WBxx_System_Private_Functions
182*0561b2d8STREFOU Felix * @{
183*0561b2d8STREFOU Felix */
184*0561b2d8STREFOU Felix
185*0561b2d8STREFOU Felix /**
186*0561b2d8STREFOU Felix * @brief Setup the microcontroller system.
187*0561b2d8STREFOU Felix * @param None
188*0561b2d8STREFOU Felix * @retval None
189*0561b2d8STREFOU Felix */
SystemInit(void)190*0561b2d8STREFOU Felix void SystemInit(void)
191*0561b2d8STREFOU Felix {
192*0561b2d8STREFOU Felix /* Configure the Vector Table location add offset address ------------------*/
193*0561b2d8STREFOU Felix #if defined(VECT_TAB_SRAM) && defined(VECT_TAB_BASE_ADDRESS)
194*0561b2d8STREFOU Felix /* program in SRAMx */
195*0561b2d8STREFOU Felix SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAMx for CPU1 */
196*0561b2d8STREFOU Felix #else /* program in FLASH */
197*0561b2d8STREFOU Felix SCB->VTOR = VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
198*0561b2d8STREFOU Felix #endif
199*0561b2d8STREFOU Felix
200*0561b2d8STREFOU Felix /* FPU settings ------------------------------------------------------------*/
201*0561b2d8STREFOU Felix #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
202*0561b2d8STREFOU Felix SCB->CPACR |= ((3UL << (10UL*2UL))|(3UL << (11UL*2UL))); /* set CP10 and CP11 Full Access */
203*0561b2d8STREFOU Felix #endif
204*0561b2d8STREFOU Felix
205*0561b2d8STREFOU Felix /* Reset the RCC clock configuration to the default reset state ------------*/
206*0561b2d8STREFOU Felix /* Set MSION bit */
207*0561b2d8STREFOU Felix RCC->CR |= RCC_CR_MSION;
208*0561b2d8STREFOU Felix
209*0561b2d8STREFOU Felix /* Reset CFGR register */
210*0561b2d8STREFOU Felix RCC->CFGR = 0x00070000U;
211*0561b2d8STREFOU Felix
212*0561b2d8STREFOU Felix /* Reset PLLSAI1ON, PLLON, HSECSSON, HSEON, HSION, and MSIPLLON bits */
213*0561b2d8STREFOU Felix RCC->CR &= (uint32_t)0xFAF6FEFBU;
214*0561b2d8STREFOU Felix
215*0561b2d8STREFOU Felix /*!< Reset LSI1 and LSI2 bits */
216*0561b2d8STREFOU Felix RCC->CSR &= (uint32_t)0xFFFFFFFAU;
217*0561b2d8STREFOU Felix
218*0561b2d8STREFOU Felix /*!< Reset HSI48ON bit */
219*0561b2d8STREFOU Felix RCC->CRRCR &= (uint32_t)0xFFFFFFFEU;
220*0561b2d8STREFOU Felix
221*0561b2d8STREFOU Felix /* Reset PLLCFGR register */
222*0561b2d8STREFOU Felix RCC->PLLCFGR = 0x22041000U;
223*0561b2d8STREFOU Felix
224*0561b2d8STREFOU Felix /* Reset PLLSAI1CFGR register */
225*0561b2d8STREFOU Felix RCC->PLLSAI1CFGR = 0x22041000U;
226*0561b2d8STREFOU Felix
227*0561b2d8STREFOU Felix /* Reset HSEBYP bit */
228*0561b2d8STREFOU Felix RCC->CR &= 0xFFFBFFFFU;
229*0561b2d8STREFOU Felix
230*0561b2d8STREFOU Felix /* Disable all interrupts */
231*0561b2d8STREFOU Felix RCC->CIER = 0x00000000;
232*0561b2d8STREFOU Felix }
233*0561b2d8STREFOU Felix
234*0561b2d8STREFOU Felix /**
235*0561b2d8STREFOU Felix * @brief Update SystemCoreClock variable according to Clock Register Values.
236*0561b2d8STREFOU Felix * The SystemCoreClock variable contains the core clock (HCLK), it can
237*0561b2d8STREFOU Felix * be used by the user application to setup the SysTick timer or configure
238*0561b2d8STREFOU Felix * other parameters.
239*0561b2d8STREFOU Felix *
240*0561b2d8STREFOU Felix * @note Each time the core clock (HCLK) changes, this function must be called
241*0561b2d8STREFOU Felix * to update SystemCoreClock variable value. Otherwise, any configuration
242*0561b2d8STREFOU Felix * based on this variable will be incorrect.
243*0561b2d8STREFOU Felix *
244*0561b2d8STREFOU Felix * @note - The system frequency computed by this function is not the real
245*0561b2d8STREFOU Felix * frequency in the chip. It is calculated based on the predefined
246*0561b2d8STREFOU Felix * constant and the selected clock source:
247*0561b2d8STREFOU Felix *
248*0561b2d8STREFOU Felix * - If SYSCLK source is MSI, SystemCoreClock will contain the MSI_VALUE(*)
249*0561b2d8STREFOU Felix *
250*0561b2d8STREFOU Felix * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(**)
251*0561b2d8STREFOU Felix *
252*0561b2d8STREFOU Felix * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
253*0561b2d8STREFOU Felix *
254*0561b2d8STREFOU Felix * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(***)
255*0561b2d8STREFOU Felix * or HSI_VALUE(*) or MSI_VALUE(*) multiplied/divided by the PLL factors.
256*0561b2d8STREFOU Felix *
257*0561b2d8STREFOU Felix * (*) MSI_VALUE is a constant defined in stm32wbxx_hal.h file (default value
258*0561b2d8STREFOU Felix * 4 MHz) but the real value may vary depending on the variations
259*0561b2d8STREFOU Felix * in voltage and temperature.
260*0561b2d8STREFOU Felix *
261*0561b2d8STREFOU Felix * (**) HSI_VALUE is a constant defined in stm32wbxx_hal_conf.h file (default value
262*0561b2d8STREFOU Felix * 16 MHz) but the real value may vary depending on the variations
263*0561b2d8STREFOU Felix * in voltage and temperature.
264*0561b2d8STREFOU Felix *
265*0561b2d8STREFOU Felix * (***) HSE_VALUE is a constant defined in stm32wbxx_hal_conf.h file (default value
266*0561b2d8STREFOU Felix * 32 MHz), user has to ensure that HSE_VALUE is same as the real
267*0561b2d8STREFOU Felix * frequency of the crystal used. Otherwise, this function may
268*0561b2d8STREFOU Felix * have wrong result.
269*0561b2d8STREFOU Felix *
270*0561b2d8STREFOU Felix * - The result of this function could be not correct when using fractional
271*0561b2d8STREFOU Felix * value for HSE crystal.
272*0561b2d8STREFOU Felix *
273*0561b2d8STREFOU Felix * @param None
274*0561b2d8STREFOU Felix * @retval None
275*0561b2d8STREFOU Felix */
SystemCoreClockUpdate(void)276*0561b2d8STREFOU Felix void SystemCoreClockUpdate(void)
277*0561b2d8STREFOU Felix {
278*0561b2d8STREFOU Felix uint32_t tmp, msirange, pllvco, pllr, pllsource , pllm;
279*0561b2d8STREFOU Felix
280*0561b2d8STREFOU Felix /* Get MSI Range frequency--------------------------------------------------*/
281*0561b2d8STREFOU Felix
282*0561b2d8STREFOU Felix /*MSI frequency range in Hz*/
283*0561b2d8STREFOU Felix msirange = MSIRangeTable[(RCC->CR & RCC_CR_MSIRANGE) >> RCC_CR_MSIRANGE_Pos];
284*0561b2d8STREFOU Felix
285*0561b2d8STREFOU Felix /* Get SYSCLK source -------------------------------------------------------*/
286*0561b2d8STREFOU Felix switch (RCC->CFGR & RCC_CFGR_SWS)
287*0561b2d8STREFOU Felix {
288*0561b2d8STREFOU Felix case 0x00: /* MSI used as system clock source */
289*0561b2d8STREFOU Felix SystemCoreClock = msirange;
290*0561b2d8STREFOU Felix break;
291*0561b2d8STREFOU Felix
292*0561b2d8STREFOU Felix case 0x04: /* HSI used as system clock source */
293*0561b2d8STREFOU Felix /* HSI used as system clock source */
294*0561b2d8STREFOU Felix SystemCoreClock = HSI_VALUE;
295*0561b2d8STREFOU Felix break;
296*0561b2d8STREFOU Felix
297*0561b2d8STREFOU Felix case 0x08: /* HSE used as system clock source */
298*0561b2d8STREFOU Felix SystemCoreClock = HSE_VALUE;
299*0561b2d8STREFOU Felix break;
300*0561b2d8STREFOU Felix
301*0561b2d8STREFOU Felix case 0x0C: /* PLL used as system clock source */
302*0561b2d8STREFOU Felix /* PLL_VCO = (HSE_VALUE or HSI_VALUE or MSI_VALUE/ PLLM) * PLLN
303*0561b2d8STREFOU Felix SYSCLK = PLL_VCO / PLLR
304*0561b2d8STREFOU Felix */
305*0561b2d8STREFOU Felix pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
306*0561b2d8STREFOU Felix pllm = ((RCC->PLLCFGR & RCC_PLLCFGR_PLLM) >> RCC_PLLCFGR_PLLM_Pos) + 1UL ;
307*0561b2d8STREFOU Felix
308*0561b2d8STREFOU Felix if(pllsource == 0x02UL) /* HSI used as PLL clock source */
309*0561b2d8STREFOU Felix {
310*0561b2d8STREFOU Felix pllvco = (HSI_VALUE / pllm);
311*0561b2d8STREFOU Felix }
312*0561b2d8STREFOU Felix else if(pllsource == 0x03UL) /* HSE used as PLL clock source */
313*0561b2d8STREFOU Felix {
314*0561b2d8STREFOU Felix pllvco = (HSE_VALUE / pllm);
315*0561b2d8STREFOU Felix }
316*0561b2d8STREFOU Felix else /* MSI used as PLL clock source */
317*0561b2d8STREFOU Felix {
318*0561b2d8STREFOU Felix pllvco = (msirange / pllm);
319*0561b2d8STREFOU Felix }
320*0561b2d8STREFOU Felix
321*0561b2d8STREFOU Felix pllvco = pllvco * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos);
322*0561b2d8STREFOU Felix pllr = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> RCC_PLLCFGR_PLLR_Pos) + 1UL);
323*0561b2d8STREFOU Felix
324*0561b2d8STREFOU Felix SystemCoreClock = pllvco/pllr;
325*0561b2d8STREFOU Felix break;
326*0561b2d8STREFOU Felix
327*0561b2d8STREFOU Felix default:
328*0561b2d8STREFOU Felix SystemCoreClock = msirange;
329*0561b2d8STREFOU Felix break;
330*0561b2d8STREFOU Felix }
331*0561b2d8STREFOU Felix
332*0561b2d8STREFOU Felix /* Compute HCLK clock frequency --------------------------------------------*/
333*0561b2d8STREFOU Felix /* Get HCLK1 prescaler */
334*0561b2d8STREFOU Felix tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos)];
335*0561b2d8STREFOU Felix /* HCLK clock frequency */
336*0561b2d8STREFOU Felix SystemCoreClock = SystemCoreClock / tmp;
337*0561b2d8STREFOU Felix
338*0561b2d8STREFOU Felix }
339*0561b2d8STREFOU Felix
340*0561b2d8STREFOU Felix
341*0561b2d8STREFOU Felix /**
342*0561b2d8STREFOU Felix * @}
343*0561b2d8STREFOU Felix */
344*0561b2d8STREFOU Felix
345*0561b2d8STREFOU Felix /**
346*0561b2d8STREFOU Felix * @}
347*0561b2d8STREFOU Felix */
348*0561b2d8STREFOU Felix
349*0561b2d8STREFOU Felix /**
350*0561b2d8STREFOU Felix * @}
351*0561b2d8STREFOU Felix */
352*0561b2d8STREFOU Felix
353*0561b2d8STREFOU Felix /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
354