|
6 | 6 | * |
7 | 7 | * 1. 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_stm32f0xx.s" file. |
12 | 12 | * |
|
101 | 101 | 2) by calling HAL API function HAL_RCC_GetHCLKFreq() |
102 | 102 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency |
103 | 103 | Note: If you use this function to configure the system clock there is no need to |
104 | | - call the 2 first functions listed above, since SystemCoreClock variable is |
| 104 | + call the 2 first functions listed above, since SystemCoreClock variable is |
105 | 105 | updated automatically. |
106 | 106 | */ |
107 | 107 | uint32_t SystemCoreClock = 8000000; |
@@ -132,63 +132,12 @@ const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4}; |
132 | 132 | */ |
133 | 133 | void SystemInit(void) |
134 | 134 | { |
135 | | - /* Reset the RCC clock configuration to the default reset state ------------*/ |
136 | | - /* Set HSION bit */ |
137 | | - RCC->CR |= (uint32_t)0x00000001U; |
138 | | - |
139 | | -#if defined (STM32F051x8) || defined (STM32F058x8) |
140 | | - /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ |
141 | | - RCC->CFGR &= (uint32_t)0xF8FFB80CU; |
142 | | -#else |
143 | | - /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ |
144 | | - RCC->CFGR &= (uint32_t)0x08FFB80CU; |
145 | | -#endif /* STM32F051x8 or STM32F058x8 */ |
146 | | - |
147 | | - /* Reset HSEON, CSSON and PLLON bits */ |
148 | | - RCC->CR &= (uint32_t)0xFEF6FFFFU; |
149 | | - |
150 | | - /* Reset HSEBYP bit */ |
151 | | - RCC->CR &= (uint32_t)0xFFFBFFFFU; |
152 | | - |
153 | | - /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ |
154 | | - RCC->CFGR &= (uint32_t)0xFFC0FFFFU; |
155 | | - |
156 | | - /* Reset PREDIV[3:0] bits */ |
157 | | - RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U; |
158 | | - |
159 | | -#if defined (STM32F072xB) || defined (STM32F078xx) |
160 | | - /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ |
161 | | - RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU; |
162 | | -#elif defined (STM32F071xB) |
163 | | - /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ |
164 | | - RCC->CFGR3 &= (uint32_t)0xFFFFCEACU; |
165 | | -#elif defined (STM32F091xC) || defined (STM32F098xx) |
166 | | - /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ |
167 | | - RCC->CFGR3 &= (uint32_t)0xFFF0FEACU; |
168 | | -#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) |
169 | | - /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ |
170 | | - RCC->CFGR3 &= (uint32_t)0xFFFFFEECU; |
171 | | -#elif defined (STM32F051x8) || defined (STM32F058xx) |
172 | | - /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ |
173 | | - RCC->CFGR3 &= (uint32_t)0xFFFFFEACU; |
174 | | -#elif defined (STM32F042x6) || defined (STM32F048xx) |
175 | | - /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ |
176 | | - RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU; |
177 | | -#elif defined (STM32F070x6) || defined (STM32F070xB) |
178 | | - /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ |
179 | | - RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU; |
180 | | - /* Set default USB clock to PLLCLK, since there is no HSI48 */ |
181 | | - RCC->CFGR3 |= (uint32_t)0x00000080U; |
182 | | -#else |
183 | | - #warning "No target selected" |
184 | | -#endif |
185 | | - |
186 | | - /* Reset HSI14 bit */ |
187 | | - RCC->CR2 &= (uint32_t)0xFFFFFFFEU; |
188 | | - |
189 | | - /* Disable all interrupts */ |
190 | | - RCC->CIR = 0x00000000U; |
191 | | - |
| 135 | + /* NOTE :SystemInit(): This function is called at startup just after reset and |
| 136 | + before branch to main program. This call is made inside |
| 137 | + the "startup_stm32f0xx.s" file. |
| 138 | + User can setups the default system clock (System clock source, PLL Multiplier |
| 139 | + and Divider factors, AHB/APBx prescalers and Flash settings). |
| 140 | + */ |
192 | 141 | } |
193 | 142 |
|
194 | 143 | /** |
@@ -271,7 +220,7 @@ void SystemCoreClockUpdate (void) |
271 | 220 | #else |
272 | 221 | /* HSI used as PLL clock source : SystemCoreClock = HSI/2 * PLLMUL */ |
273 | 222 | SystemCoreClock = (HSI_VALUE >> 1) * pllmull; |
274 | | -#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 || |
| 223 | +#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 || |
275 | 224 | STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || |
276 | 225 | STM32F091xC || STM32F098xx || STM32F030xC */ |
277 | 226 | } |
|
0 commit comments