Stm32f4xx that thing. (ii)--configuration of the system clock

Source: Internet
Author: User

Every time I contact a new microcontroller, I will be very curious how many MHz the microcontroller's system clock, how to reach the maximum system clock described in datasheet, the microcontroller's peripheral clock will be how many MHz it? If I want to use delay, how can I write a program to achieve a precise delay? I think these are the questions I need to know before I start contacting a new microcontroller.

For each ARM CORTEX-M series SCM, manufacturers in order to better promote their own microcontroller, at the same time to facilitate the use of designers, reduce product development cycle, will be the microcontroller peripheral related registers and peripherals related functions are implemented and packaged, on the official website free for everyone to use. The standard peripheral Library of the STM32F405RG also contains various operational functions with DSP cores. If required, you can ttp://www2.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/from H stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32065.html# download.

If you use the standard peripherals Library, we can follow the code analysis in the system_stm32f4xx.c file in the standard Peripherals Library:

#if  defined (stm32f40_41xxx)  | |  defined (stm32f427_437xx)  | |  defined (stm32f429_439xx)  | |  defined (stm32f401xx)  | |  defined (stm32f469_479xx)   #define  pll_m      25#elif defined   (stm32f446xx)   #define  PLL_M      8#elif defined  ( STM32F410XX)  | |  defined  (stm32f411xe)   #if  defined (use_hse_bypass)    #define  PLL_M       8      #else  /* ! use_hse_bypass */   #define  PLL_M      16  #endif  /*  use_hse_bypass */#else #endif#if defined  (stm32f40_41xxx) #define  PLL_N       336/* sysclk = pll_vco / pll_p */#define  PLL_P       2#endif#if defined (stm32f40_41xxx)   uint32_t systemcoreclock = 168000000; #endif 

According to the programming Manual on the contents of the clock Register,

Pll_vco = (Hse_value or hsi_value/pll_m) * Pll_n

sysclk=pll_vco/pll_p

, Hse_value represents the frequency of the single-chip external crystal oscillator, Hsi_value represents the frequency of the internal oscillator, the experiment board using the external 25MHz crystal oscillator, according to the configuration of the program, we can calculate the Systemcoreclock = 168000000.


This article is from the "intentions to create" blog, please be sure to keep this source http://chasingdreams.blog.51cto.com/2790339/1768816

Stm32f4xx that thing. (ii)--configuration of the system clock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.