Calculation and setting of STM32PWM waveform

Source: Internet
Author: User

When sysclk equals 72M,APB1 equals 36M APB2 equals 72M, the timer clock is 72M. Note This sentence: if the APB1/APB2 prescaler =1 The frequency is constant, otherwise the frequency x2. If at this time, APB1 Division 2, the PCLK1 external clock is 36M, at this time the timer clock X2 is 72M;APB2 Division 1, the PCLK2 external clock is 72M, at this time the timer clock equals PCLK2 clock 72M.

Second, timer Prescaler frequency

When the timer clock is set, a timer prescaler is required to further configure timing functions for different application cycles. At this time the timer clock frequency is 72m/tim_prescaler. Note that the value at this point is the frequency value, so a oscillation period is tim_prescaler/72m.

Third, the timer period or frequency and the PWM duty cycle setting

Set the value of the automatic load register, you can get different timing of the timer, the timing of the time period is: (tim_prescaler/72m) *tim_period. The PWM frequency is 1/: ((tim_prescaler/72m) *tim_period). Then set the value of the capture comparison register to determine the duty ratio of the PWM.

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.