Necessary configuration when using the firmware library to operate STM32F4

Publisher:心灵律动Latest update time:2017-02-05 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When using the STM32F4 firmware library, the default crystal oscillator is a 25Mhz crystal oscillator, so some modifications need to be made. Because I had not paid attention to this problem before, I fiddled with it for a long time and found that the working clock was always wrong. After checking the information, I realized that there were several places that needed to be modified.

 

Original link: Modify the crystal value in the STM32 library function 

 

The default crystal value in the STM32F407 library file is 25MHz. If the external crystal oscillator is 8MHz, the following places need to be modified:

1) Modify the value of HSE_VALUE

Will #define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */

Modify to #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */

2) Modify the value of PLL_M

Change #define PLL_M 25 to #define PLL_M 8

3) Modify the Options settings of the STM32F407 project

In the Option for target "Flash" window, select the Target page and change the value of Xtal (MHz) in the STMicroelectronics STM32F407VG column to 8.0


Reference address:Necessary configuration when using the firmware library to operate STM32F4

Previous article:USB to serial communication in stm32f4USART
Next article:Hardware I2C of STM32F407

Recommended ReadingLatest update time:2024-11-16 19:32

stm32F4XX window watchdog HAL library
First, let’s talk about the difference between an independent watchdog and a window watchdog. Independent watchdog Iwdg——Independent of the system, because it has an independent clock, usually an external low-speed clock. Mainly used to monitor hardware errors. Window watchdog wwdg - a fault detector inside the sy
[Microcontroller]
stm32F4XX window watchdog HAL library
STM32f4---Timer interrupt experimental code
Let's take a look at our time.c file. The code of the timer.c file is as follows: //General timer 3 interrupt initialization //arr: automatic reload value. psc: clock pre-division number //Timer overflow time calculation method: Tout=((arr+1)*(psc+1))/Ft us. //Ft=timer operating frequency, unit: Mhz //Timer 3 is used
[Microcontroller]
STM32F4 (read chip ID)
Unique device identifiers are suitable for: ● Used as a serial number (e.g. USB string serial number or other terminal applications) ● Use the unique ID as a security key when used in conjunction with software encryption primitives and protocols before programming the internal Flash to increase the security of the cod
[Microcontroller]
Bit counter count of stm32f432
Everyone knows that stm32f4 has rich internal resources and powerful external peripherals. It has two 32-bit counters, which is very good for many projects that need to count pulses. It not only saves the expansion of external counters and saves PCB space, but also makes program design much simpler. Since I have just
[Microcontroller]
STM32F4 ADC1 analog watchdog [library function operation]
The analog watchdog of the ADC is used to check if the voltage is out of bounds. It has two upper and lower bounds, which can be set in the registers ADC_HTR and ADC_LTR respectively. The library function is set using ADC_AnalogWatchdogThresholdsConfig, which is very simple for both regular and injected channels. When
[Microcontroller]
STM32F4 FLASH read and write operations
The STM32F407VGT6 chip used by the STM32F4Discovery development team has an internal FLASH of 1M. After the code is burned, there is still a lot of remaining. Effective use of this remaining FLASH can store a lot of data. Therefore, some operations of reading and writing the internal FLASH of STM32F4 are studied. Th
[Microcontroller]
STM32F4 FLASH read and write operations
STM32f4---OLCD display experimental code (02)
  OLED_CS=1;   OLED_RS=1;  OLED_RST=0;   delay_ms(100);   OLED_RST=1;     OLED_WR_Byte(0xAE,OLED_CMD); //Turn off the display   OLED_WR_Byte(0xD5,OLED_CMD); //Set clock division factor, oscillation frequency   OLED_WR_Byte(80,OLED_CMD); // , frequency division factor; , oscillation frequency   OLED_WR_Byte(0xA8,OLED_C
[Microcontroller]
STM32F407 ADC clock setting and sampling frequency setting
/****************************************************** In system_stm32f4xx.c there are the following definitions:   /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N / / /     #define PLL_M 8     #define PLL_N 336     /* SYSCLK = PLL_VCO / PLL_P //     #define PLL_P 2     /* USB OTG FS, SDIO and RNG
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号