/*******************************************************************************
* Function name: RCC_Configuration
* Function: 25MHZ Set the clock of each part of the system
* Parameter variable: NONE
* Global variable: NONE
* Calling function:
* Author:
* Writing time:
* 修改时间:
* 版 本: V1.0
* 状 态:调试完成
*******************************************************************************/
void RCC_Configuration(void)
{
RCC_DeInit();
RCC_HSEConfig(RCC_HSE_ON);// Enable HSE
HSEStartUpStatus = RCC_WaitForHSEStartUp();//Wait till HSE is ready
if(HSEStartUpStatus==SUCCESS)
{
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);//Enable Prefetch Buffer
FLASH_SetLatency(FLASH_Latency_2); // Flash 2 wait state
RCC_HCLKConfig(RCC_SYSCLK_Div1);//HCLK = SYSCLK
RCC_PCLK2Config(RCC_HCLK_Div1);//PCLK2 = HCLK
RCC_PCLK1Config(RCC_HCLK_Div2);//PCLK1 = HCLK/2
RCC_ADCCLKConfig(RCC_PCLK2_Div4);//ADCCLK = PCLK2/4
#ifndef STM32F10X_CL
RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9);//PLLCLK = 8MHz * 9 = 72 MHz
#else
// Configure PLLs *********************************************************
//PLL2 configuration: PLL2CLK = (HSE / 5) * 8 = 40 MHz
RCC_PREDIV2Config(RCC_PREDIV2_Div5);
RCC_PLL2Config(RCC_PLL2Mul_8);
RCC_PLL2Cmd(ENABLE);
while(RCC_GetFlagStatus(RCC_FLAG_PLL2RDY)== RESET)
{}
RCC_PREDIV1Config(RCC_PREDIV1_Source_PLL2,RCC_PREDIV1_Div5);
RCC_PLLConfig(RCC_PLLSource_PREDIV1,RCC_PLLMul_9);//PLLCLK = 8MHz * 9 = 72 MHz
RCC_PLL3Config(RCC_PLL3Mul_11);
RCC_PLL3Cmd(ENABLE);
while(RCC_GetFlagStatus(RCC_FLAG_PLL3RDY)== RESET)
{}
RCC_I2S3CLKConfig(RCC_I2S3CLKSource_PLL3_VCO);
RCC_I2S2CLKConfig(RCC_I2S2CLKSource_PLL3_VCO);
#endif
RCC_PLLCmd(ENABLE);// Enable PLL
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)// Wait till PLL is ready
{
}
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);// Select PLL as system clock source
while(RCC_GetSYSCLKSource() != 0x08)// Wait till PLL is used as system clock source
{
}
}
}
Previous article:STM32 APB1 bus clock configuration problem
Next article:STM32 ADC and DMA multi-channel processing
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- AD17 There is a problem with copper laying on a four-layer board
- Static Timing Analysis Basics and Applications
- How to use Segger Embedded Studio to develop the HPM6750?
- 485 Point-to-Many Communication Problem
- The program of the microcontroller is lost, what's going on?
- EEWORLD University Hall----Audio Amplifier for Smart Speaker
- Qorvo Expands 1.8 GHz DOCSIS 4.0 Portfolio
- Gain Circuit Compensation
- [Hua Diao Experience] 01 Getting Started with Xingkong Board
- Discharge needle under the common mode inductor