To reduce power consumption, the clock management module can stop the clocks to the CPU, memory, and other independent peripherals.
There are four clock sources:
External high speed crystal oscillator (HSE 1-16MHZ)
Internal high speed RC oscillator (HSI 16MHZ)
External low speed crystal oscillator (LSE 32.768)
Internal low speed RC oscillator (LSI 38KHZ)
The default startup clock is internal 2MHZ (HIS/8)
The CSS clock safety system can be enabled by software. Once enabled, the system can automatically switch to HSI when the HSE stops oscillating.
CCO clock output function
1. Select the clock source
void CLK_DeInit(void) Reset all clock registers
void CLK_HSICmd(FunctionalState NewState) Enable or disable the internal high speed oscillator
void CLK_HSEConfig(CLK_HSE_TypeDef CLK_HSE) Enable, disable or bypass the external high speed oscillator
Parameters CLK_HSE_OFF CLK_HSE_ON CLK_HSE_Bypass
void CLK_ClockSecuritySystemEnable(void) CSS clock security system enable
2. Configure CPU clock
void CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_TypeDef CLK_SYSCLKSource)
Parameters: CPU clock source CLK_SYSCLKSource_HSI CLK_SYSCLKSource_HSE
CLK_SYSCLKSource_LSI CLK_SYSCLKSource_LSE
void CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_TypeDef CLK_SYSCLKDiv)
Parameters: CPU clock division coefficient CLK_SYSCLKDiv_1 CLK_SYSCLKDiv_2 CLK_SYSCLKDiv_4
CLK_SYSCLKDiv_8 CLK_SYSCLKDiv_16 CLK_SYSCLKDiv_64 CLK_SYSCLKDiv_128
3. Enable the peripheral clocks used
void CLK_PeripheralClockConfig(CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState)
The first parameter is the peripheral name, such as CLK_Peripheral_TIM1. The second parameter is enable/disable.
4. Configure other peripherals that use non-CPU clocks (RTC/LCD, BEEP, etc.)
Previous article:IIC protocol based on stm8 --- DS3231 clock module reading
Next article:STM8 series MCU timer operation
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Digital frequency meter design
- Audio Pre-Processing System Reference Design Using C5517
- EEWORLD University Hall ---- Image Processing and Analysis by Jia Yonghong, Wuhan University
- Weekly highlights: 2018.11.26-12.2
- Some measures to prevent digital circuits from being disturbed in single chip microcomputers
- Wireless communication solution for HMI control of crane feeding in copper processing workshop
- ADC conversion chip hx711
- Read the information and fill out the questionnaire to win prizes: Keysight Technologies' automotive Ethernet test solution and IXIA automotive Ethernet technology white paper
- DSP generates hex file and bin file method
- [RT-Thread Reading Notes] Threads and Critical Protection