131 #include "stm32f4xx.h"   155 #define VECT_TAB_OFFSET  FLASH_OFFSET    192   __I uint8_t 
AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
   227   RCC->CR |= (uint32_t)0x00000001;
   230   RCC->CFGR = 0x00000000;
   233   RCC->CR &= (uint32_t)0xFEF6FFFF;
   236   RCC->PLLCFGR = 0x24003010;
   239   RCC->CR &= (uint32_t)0xFFFBFFFF;
   242   RCC->CIR = 0x00000000;
   251     SCB->VTOR = (uint32_t)&__isr_vector_start;
   292   uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
   295   tmp = RCC->CFGR & RCC_CFGR_SWS;
   310       pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
   311       pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
   316         pllvco = (
HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
   321         pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);      
   324       pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
   353   __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
   356   RCC->CR |= ((uint32_t)RCC_CR_HSEON);
   361     HSEStatus = RCC->CR & RCC_CR_HSERDY;
   363   } 
while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
   365   if ((RCC->CR & RCC_CR_HSERDY) != RESET)
   367     HSEStatus = (uint32_t)0x01;
   371     HSEStatus = (uint32_t)0x00;
   374   if (HSEStatus == (uint32_t)0x01)
   377     RCC->APB1ENR |= RCC_APB1ENR_PWREN;
   378     PWR->CR |= PWR_CR_PMODE;  
   381     RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
   384     RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;
   387     RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;
   399     uint8_t pll_m=4,  pll_q, pll_p=2;
   401     uint8_t flash_latency;
   402     uint32_t cr_flags = RCC_CR_CSSON;
   407         flash_latency = FLASH_ACR_LATENCY_5WS;
   411         pll_n=360; pll_q=15; pll_p=4;
   412         flash_latency = FLASH_ACR_LATENCY_5WS;
   418         flash_latency = FLASH_ACR_LATENCY_6WS;
   423         flash_latency = FLASH_ACR_LATENCY_6WS;
   428         flash_latency = FLASH_ACR_LATENCY_7WS;
   433         flash_latency = FLASH_ACR_LATENCY_7WS;
   442     RCC->PLLCFGR = pll_m | (pll_n << 6) | (((pll_p >> 1) -1) << 16) |
   443                    (RCC_PLLCFGR_PLLSRC_HSE) | (pll_q << 24);
   446     RCC->CR |= RCC_CR_PLLON | cr_flags;
   450     while((RCC->CR & RCC_CR_PLLRDY) == 0)  {  }
   454     FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN | flash_latency;
   457     RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
   458     RCC->CFGR |= RCC_CFGR_SW_PLL;
   461     while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL) {}
   463     FLASH->ACR |= FLASH_ACR_PRFTEN; 
   478   RCC->CFGR &= ~RCC_CFGR_I2SSRC;
   482 #if 0 // we don't use I2S   484   RCC->CR |= ((uint32_t)RCC_CR_PLLI2SON);
   487   while((RCC->CR & RCC_CR_PLLI2SRDY) == 0)  { }
 
void SystemCoreClockUpdate(void)
Update SystemCoreClock variable according to Clock Register Values. The SystemCoreClock variable cont...
 
void SetSysClock(uint8_t oc)
Configures the System clock source, PLL Multiplier and Divider factors, AHB/APBx prescalers and Flash...
 
void __error(uint32_t num, uint32_t pc, uint32_t lr, uint32_t flag)
 
void uint32_t uint32_t lr
 
__I uint8_t AHBPrescTable[16]
 
unsigned __isr_vector_start
 
void uint32_t uint32_t uint32_t flag
 
void systemInit(uint8_t oc)
Setup the microcontroller system Initialize the Embedded Flash Interface, the PLL and update the Syst...