8919 views|11 replies

76

Posts

0

Resources
The OP

STM32f103 PWM output [Copy link]

After looking at several examples, I still don't understand how to set the value of TIM_period when outputting PWM.
The reference book says: Since the clock frequency of the TIM1 counter is 72MHz, and the desired channel output frequency is 17.57KHz, the value of the TIM1 prescaler TIM1_period is 0xFFFF. How is this value calculated?
Please give me detailed instructions if you know. Thank you in advance!
This post is from stm32/stm8

Latest reply

                                 The output frequency is 17.57KHz. According to the formula f=TIM1CLK/(TIM1_period+1), the value of TIM1 prescaler TIM1_period is 0xFFFF  Details Published on 2010-4-9 11:15

79

Posts

0

Resources
2
                                 Which reference book?
This post is from stm32/stm8

70

Posts

0

Resources
3
STM32 processor development and application based on MDK
Beihang University
Edited by Li Ning
This post is from stm32/stm8

71

Posts

0

Resources
4
Which page?

It is best to copy the relevant content in full, as no one can answer a question with just a few words.
This post is from stm32/stm8

68

Posts

0

Resources
5
Page 283 of the book
Design requirements: Control the TIM1 timer so that each channel output is inserted into the complementary PWM output, and the output frequency of each channel is 17.57KHz. The duty cycle of channel 1 is 50%, the duty cycle of channel 2 is 25%, and the duty cycle of channel 3 is 12.5%.
Software design: Since the constant frequency of the TIM1 counter is 72MHz, it is hoped that the output frequency of each channel is 17.57KHz. According to the formula f=TIM1CLK/(TIM1_period+1), the value of the TIM1 prescaler TIM1_period is 0xFFFF
TIM1_prescaler=0x0
TIM1_period=0xFFFF
TIM1_ClockDivision=0x0
TIM1_RepetitionCounter=0x0
This post is from stm32/stm8

63

Posts

0

Resources
6
                                 You can try that example. There may be a typographical error, where 0x0FFF is written as 0xFFFF.
This post is from stm32/stm8

70

Posts

0

Resources
7
                                 I'll try it then, thanks to the moderator!!!
This post is from stm32/stm8

78

Posts

0

Resources
8
                                 The coefficient must be deduced from the formula
This post is from stm32/stm8

73

Posts

0

Resources
9
                                 The publisher is too irresponsible
This post is from stm32/stm8

67

Posts

0

Resources
10
                                 It is best to read English materials, which have fewer errors. Translated Chinese materials will always have errors or inaccuracies.
This post is from stm32/stm8

71

Posts

0

Resources
11
                                 Well, thank you for your pointers!
This post is from stm32/stm8

99

Posts

0

Resources
12
                                 The output frequency is 17.57KHz. According to the formula f=TIM1CLK/(TIM1_period+1), the value of TIM1 prescaler TIM1_period is 0xFFFF
This post is from stm32/stm8

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list