106 #include "stm32f30x.h"
126 #define VECT_TAB_OFFSET 0x0
144 uint32_t SystemCoreClock = 72000000;
146 __I uint8_t
AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
175 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
176 SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));
181 RCC->CR |= (uint32_t)0x00000001;
184 RCC->CFGR &= 0xF87FC00C;
187 RCC->CR &= (uint32_t)0xFEF6FFFF;
190 RCC->CR &= (uint32_t)0xFFFBFFFF;
193 RCC->CFGR &= (uint32_t)0xFF80FFFF;
196 RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
199 RCC->CFGR3 &= (uint32_t)0xFF00FCCC;
202 RCC->CIR = 0x00000000;
252 uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0;
255 tmp = RCC->CFGR & RCC_CFGR_SWS;
267 pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
268 pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
269 pllmull = ( pllmull >> 18) + 2;
271 if (pllsource == 0x00)
278 prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
303 __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
311 RCC->CR |= ((uint32_t)RCC_CR_HSEON);
316 HSEStatus = RCC->CR & RCC_CR_HSERDY;
318 }
while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
320 if ((RCC->CR & RCC_CR_HSERDY) != RESET)
322 HSEStatus = (uint32_t)0x01;
326 HSEStatus = (uint32_t)0x00;
329 if (HSEStatus == (uint32_t)0x01)
332 FLASH->ACR = FLASH_ACR_PRFTBE | (uint32_t)FLASH_ACR_LATENCY_1;
335 RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
338 RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1;
341 RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE1_DIV2;
344 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
345 RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL9);
348 RCC->CR |= RCC_CR_PLLON;
351 while((RCC->CR & RCC_CR_PLLRDY) == 0)
356 RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
357 RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
360 while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
static void SetSysClock(void)
Configures the System clock source, PLL Multiplier and Divider factors, AHB/APBx prescalers and Flash...
void SystemCoreClockUpdate(void)
Update SystemCoreClock variable according to Clock Register Values. The SystemCoreClock variable cont...
void SystemInit(void)
Setup the microcontroller system Initialize the Embedded Flash Interface, the PLL and update the Syst...
__I uint8_t AHBPrescTable[16]