If you want to change the external 12M crystal to an 8M crystal, and still use a 72MHZ clock, you only need to change three places:
First: stm32f10x.h and system_gd32f10x.c files can be found by the following figure
1. In stm32f10x.h, change #define HSE_VALUE ((uint32_t)12000000) to #define HSE_VALUE ((uint32_t)8000000)
In stm32f10x.h, the changes are as follows
2. In system_gd32f1x0.c, the macro of 72M is used, which is changed to the following:
//#define SYSCLK_FREQ_HSE HSE_VALUE
//#define SYSCLK_FREQ_24MHz 24000000
//#define SYSCLK_FREQ_36MHz 36000000
//#define SYSCLK_FREQ_48MHz 48000000
//#define SYSCLK_FREQ_56MHz 56000000
#define SYSCLK_FREQ_72MHz 72000000
After changing the stm32f10x.h file, the data is as follows
3. If you are debugging and downloading in Keil, modify the project options as follows: change the Xtal (MHz) label from 12.0 to 8.0.
Finally, be sure to note that when configuring the clock, do not forget to change the frequency multiplication factor. In the clock initialization function void RCC_Configuration(void), change RCC_PLLMul_6 to RCC_PLLMul_9, that is:
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
Of course, if you change 8M to 12M or other crystal oscillators, the method is similar
Previous article:Using 12M external crystal oscillator with stm32 under IAR
Next article:How to modify the code when STM32 uses a non-8M crystal
- 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
- 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
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Bluetooth 5 standard
- 【Home Treasure】 esp32s2 lvgl running clock display
- 【TouchGFX Design】Use TouchGFX to develop STM32 interface software installation and Hello World
- Here is a 555 timer simulation, the output is adjustable duty cycle (less than 50%), the previous simulation, but this simulation is wrong...
- Code efficiency in TMS320F28377S Flash and RAM
- [Xianji HPM6750EVKMINI Review] 3# HPM6750 Control of RW007 Module
- Question about transistor base emitter saturation voltage
- Problems with switching tube oscillation and inversion
- Can this be done at the input end of the optocoupler?
- KiCad 5.1.6 released