MCPcopy Create free account
hub / github.com/andysworkshop/stm32plus / SystemInit

Function SystemInit

examples/timer_encoder/system/f042_48_8/System.c:151–182  ·  view source on GitHub ↗

* @brief Setup the microcontroller system. * Initialize the Embedded Flash Interface, the PLL and update the * SystemCoreClock variable. * @param None * @retval None */

Source from the content-addressed store, hash-verified

149 * @retval None
150 */
151void SystemInit (void)
152{
153 /* Set HSION bit */
154 RCC->CR |= (uint32_t)0x00000001;
155
156 /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
157 RCC->CFGR &= (uint32_t)0xF8FFB80C;
158
159 /* Reset HSEON, CSSON and PLLON bits */
160 RCC->CR &= (uint32_t)0xFEF6FFFF;
161
162 /* Reset HSEBYP bit */
163 RCC->CR &= (uint32_t)0xFFFBFFFF;
164
165 /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
166 RCC->CFGR &= (uint32_t)0xFFC0FFFF;
167
168 /* Reset PREDIV1[3:0] bits */
169 RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
170
171 /* Reset USARTSW[1:0], I2CSW, CECSW and ADCSW bits */
172 RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;
173
174 /* Reset HSI14 bit */
175 RCC->CR2 &= (uint32_t)0xFFFFFFFE;
176
177 /* Disable all interrupts */
178 RCC->CIR = 0x00000000;
179
180 /* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
181 SetSysClock();
182}
183
184/**
185 * @brief Update SystemCoreClock according to Clock Register Values

Callers

nothing calls this directly

Calls 1

SetSysClockFunction · 0.70

Tested by

no test coverage detected