1 /* ################################ System and Clock Configuration ########################### */
2 /**************************************************************************************************/
4 \defgroup system_init_gr System and Clock Configuration
5 \brief Functions for system and clock setup available in system_<i>device</i>.c.
7 ARM provides a template file <b>system_<i>device</i>.c</b> that must be adapted by
8 the silicon vendor to match their actual device. As a <b>minimum requirement</b>,
9 this file must provide:
10 - A device-specific system configuration function, \ref SystemInit().
11 - A global variable that contains the system frequency, \ref SystemCoreClock.
13 The file configures the device and, typically, initializes the oscillator (PLL) that is part
14 of the microcontroller device. This file might export other functions or variables that provide
15 a more flexible configuration of the microcontroller system.
18 \section system_init_code_ex_sec Code Example
19 The code below shows the usage of the variable \ref SystemCoreClock and the functions
20 SystemInit() and SystemCoreClockUpdate() with an LPC1700.
25 uint32_t coreClock_1 = 0; /* Variables to store core clock values */
26 uint32_t coreClock_2 = 0;
31 coreClock_1 = SystemCoreClock; /* Store value of predefined SystemCoreClock */
33 SystemCoreClockUpdate(); /* Update SystemCoreClock according to register settings */
35 coreClock_2 = SystemCoreClock; /* Store value of calculated SystemCoreClock */
37 if (coreClock_2 != coreClock_1) { /* Without changing the clock setting both core clock values should be the same */
49 /**************************************************************************************************/
51 \brief Variable to hold the system core clock value
53 Holds the system core clock, which is the system clock frequency supplied to the SysTick
54 timer and the processor core clock. This variable can be used by debuggers to query the
55 frequency of the debug timer or to configure the trace clock speed.
57 \attention Compilers must be configured to avoid removing this variable in case the application
58 program is not using it. Debugging systems require the variable to be physically
59 present in memory so that it can be examined to configure the debugger.
61 uint32_t SystemCoreClock;
64 /**************************************************************************************************/
66 \brief Function to Initialize the system.
68 Initializes the microcontroller system. Typically, this function configures the
69 oscillator (PLL) that is part of the microcontroller device. For systems
70 with a variable clock speed, it updates the variable \ref SystemCoreClock.
71 SystemInit is called from the file <b>startup<i>_device</i></b>.
73 void SystemInit (void);
76 /**************************************************************************************************/
78 \brief Function to update the variable \ref SystemCoreClock
80 Updates the variable \ref SystemCoreClock and must be called whenever the core clock is changed
81 during program execution. The function evaluates the clock register settings and calculates
82 the current core clock.
84 void SystemCoreClockUpdate (void);
87 /** @} */ /* end group system_init_gr */