About STM32F4 timer clock frequency problem

Publisher:SereneNature7Latest update time:2017-09-29 Source: eefocusKeywords:STM32F4 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere


From the clock tree we can know

(1) The clock source of advanced timer timer1, timer8 and general timer timer9, timer10, timer11 is APB2 bus.
(2) The clock source of general timer timer2~timer5, general timer timer12~timer14 and basic timer timer6, timer7 is APB1 bus.

From the internal clock tree of STM32F4, we can see that

(1) When the division number of APB1 and APB2 is 1, the clock of TIM1, TIM8~TIM11 is the clock of APB2, and the clock of TIM2~TIM7, TIM12~TIM14 is the clock of APB1;

(2) If the division ratio of APB1 and APB2 is not 1, the clocks of TIM1, TIM8 to TIM11 are twice the clock of APB2, and the clocks of TIM2 to TIM7, TIM12 to TIM14 are twice the clock of APB1.

According to the clock analysis, click to open the link , we can see

Because the APB1 bus clock is initialized to 42M divided by 4 and the APB2 bus clock is initialized to 84M divided by 2 in the SystemInit function, the clocks of TIM1, TIM8~TIM11 are twice the APB2 clock, i.e. 168M, and the clocks of TIM2~TIM7, TIM12~TIM14 are twice the APB1 clock, i.e. 84M.

Knowing the clock source frequency of the timer, it is very convenient to use the timer for delay. We just need to set the appropriate frequency division coefficient. Here is the formula for delay using interrupts: (from the Atomic STM32F4 Development Guide)
                      Tout = ((arr+1)*(psc+1))/Tclk;
In the formula, psc is the frequency division coefficient, arr is the count value, and when this count is reached, an overflow interrupt will occur. Tclk is the clock source frequency I analyzed above.


Keywords:STM32F4 Reference address:About STM32F4 timer clock frequency problem

Previous article:Share the problem about the stm32f407 timer clock frequency
Next article:How to set the system clock for STM32F4

Recommended ReadingLatest update time:2024-11-16 15:38

STM32F405 and STM32F407CAN configuration
The CAN configurations of STM32F405 and STM32F407 are slightly different. The difference is that 407 has an additional level pull-up and pull-down mode, so be sure to pay attention to this when configuring. Secondly, to open CAN2, CAN1 must be opened, because CAN1 is the master and CAN2 is the slave; after opening the
[Microcontroller]
Description of the lifting wavelet (second generation wavelet) decomposition program based on STM32F4
1. Main ideas  Original signal: OrgSig Different from the wavelet transform based on MALLAT algorithm, the lifting wavelet transform does not generate array L, but only array C. It is defined as follows:  DWT_C: , where cDx represents the detail coefficients of the x-th layer and cAN represents the approximation c
[Microcontroller]
Description of the lifting wavelet (second generation wavelet) decomposition program based on STM32F4
Summary of driver modification errors for STM32F407 Ethernet external clock source
In the sample code: void ETH_GPIO_Config(void) {      GPIO_InitTypeDef GPIO_InitStructure;     /* Enable GPIOs clocks */     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |                          RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOE |                          RCC_AHB1Periph _GPIOG, ENABL
[Microcontroller]
STM32F407 implements matrix keyboard program
I'm working on a project related to buttons recently, and I use a matrix keyboard. There are few programs related to matrix keyboards on the Internet, so I wrote one and posted it for your reference. The GPIO ports used in the program are PD0--PD7. As for the principle of the matrix keyboard, I won't describe it one b
[Microcontroller]
STM32F4 serial port DMA configuration
When using the serial port, query transmission and interrupt reception are generally used. However, when receiving a long string of data, a serial port interrupt is entered every time a byte is received, which may cause the interrupt to take too long. If there is a way to allow the serial port to interrupt once after
[Microcontroller]
PIC16F877A TIMER1 counting operation
/**********************  Title:PIC16F877A TIMER1 counting operation  Author:hnrain  Date:2010-12-28 Use pre-divider  T1CKPS1 T1CKPS1       0 0 1 Division TMR1 clock is crystal clock/(4*1)     0 1 2 Division TMR1 clock is crystal clock/(4*2)     1 0 4 Division TMR1 clock is crystal clock/(4*4)     1 1 8 Divisi
[Microcontroller]
STM32F4 uses hardware SPI to drive ADS8322
I have written code for STM32F103ZET6 to drive ADS8332 before, but it used IO to simulate SPI driver, which can be found in the front of this blog. Today, I wrote code for STM32F429BIT6 to drive ADS8332 on the STE_V2.1 verification platform. This time, I used the hardware SPI of STM32F4, SPI2. I tested the code myself
[Microcontroller]
STM32F407 advanced timer dead zone complementary PWM (operation register)
There are many functions of the advanced timer, and here we only introduce the dead zone complementary PWM output function. In fact, the dead zone complementary PWM is not much different from the PWM configuration of the general timer, except that it is necessary to set several bits in the multi-CCER register and the
[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号