/*!< Uncomment the line corresponding to the desired System clock (SYSCLK)
frequency (after reset the HSI is used as SYSCLK source) */
//#define SYSCLK_FREQ_HSE HSE_Value
//#define SYSCLK_FREQ_20MHz 20000000
//#define SYSCLK_FREQ_36MHz 36000000
//#define SYSCLK_FREQ_48MHz 48000000
//#define SYSCLK_FREQ_56MHz 56000000
#define SYSCLK_FREQ_72MHz 72000000
/*!< Uncomment the following line if you need to use external SRAM mounted
on STM3210E-EVAL board (STM32 High density devices) as data memory */
#ifdef STM32F10X_HD
// #define DATA_IN_ExtSRAM
#endif /* STM32F10X_HD */
#elif defined SYSCLK_FREQ_72MHz
/**
* @brief Sets System clock frequency to 72MHz and configure HCLK, PCLK2
* and PCLK1 prescalers.
* @param None.
* @arg None.
* @NOTE : This function should be used only after reset.
* @retval value: None.
*/
static void SetSysClockTo72(void)
{
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/*!< Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSEStartUp_TimeOut));
/*!< Select PLL as system clock source */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
w_count1 =0;
/*!< Wait till PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08)
{
w_count1 ++;
if(w_count1 >=65530)
{
__set_FAULTMASK(1); //¹Ø±ÕËùÓÐÖжÏ
NVIC_SystemReset(); //¸´Î»
}
}
}
else
{ /*!< If HSE fails to start-up, the application will have wrong clock
configuration. User can add here some code to deal with this error */
w_count1 =0;
/*!< Go to infinite loop */
while (1)
{
w_count1 ++;
if(w_count1 >=65530)
{
__set_FAULTMASK(1); //¹Ø±ÕËùÓÐÖжÏ
NVIC_SystemReset(); //¸´Î»
}
}
}
}
#endif