0% found this document useful (0 votes)
165 views6 pages

Calculate PWM Frequency

The document discusses configuring a timer peripheral to generate a pulse-width modulated (PWM) signal at a desired frequency. It provides the default timer clock frequency, desired PWM frequency, calculated timer tick frequency, prescaler value, and timer period to achieve the desired PWM frequency. It also shows equations that can be used to calculate the required timer configuration values from the desired frequency.

Uploaded by

MIGUEL SALAS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views6 pages

Calculate PWM Frequency

The document discusses configuring a timer peripheral to generate a pulse-width modulated (PWM) signal at a desired frequency. It provides the default timer clock frequency, desired PWM frequency, calculated timer tick frequency, prescaler value, and timer period to achieve the desired PWM frequency. It also shows equations that can be used to calculate the required timer configuration values from the desired frequency.

Uploaded by

MIGUEL SALAS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Timer default frequency= 108000000 Hz APB1 o 2 timer clock

Prescaler= 73 2.6 Values that can be e


TIM period= 5800 Counter period

Timer tick frequency= 1459459.4595

PWM frequency= 503.17512824

Desired PWM Frequency = 500

Timer tick frequency obtained= 2900500


Timer APB1/2 timer clock calculated= 108000000

Prescaller= 36.23495949

Timer period= 2917.9189189


Values that can be edited!!

Hz timer_tick_frequency = Timer_default_frequency / (prescaller_set + 1)  

Hz  PWM_frequency = timer_tick_frequency / (TIM_Period + 1)

Hz 96000

Hz Timer_tick_frequency =  PWM_frequency * (TIM_Period + 1)


Hz

prescaller_se = (Timer_default_frequency / timer_tick_frequency) - 1 

TIM_Period = (timer_tick_frequency / PWM_frequency) - 1


Values that can be edited
Peripheral Clock
APB1/APB2 = 54000000 Hz
Prescaler = 8

ADC Clock = 6750000 Hz

Sampling Time = 480 Cycles

Total conversion time (Tconv) = 492 Cycles


Tconv to us = 72.889E-6 s (us)
frequency = 13.72E+3 Hz
ues that can be edited!!

Tconv = Sampling time + 12 cycles


Tconv_us = Tconv/ADC Clock
Timer default frequency= 108000000 Hz APB1 o 2 timer clock
Prescaler= 179 Values that can be e
TIM period= 599 Counter period

Timer tick frequency= 600000

TIM frequency= 1000

Perido = 0.001

The Desired TIM Frequency = 1000

Timer tick frequency obtained= 600000


Timer APB1/2 timer clock calculated= 108000000

(Values to set) Prescaller= 179

(Values to set) Timer period= 599


Values that can be edited!!

Hz timer_tick_frequency = Timer_default_frequency / (prescaller_set + 1)  

Hz  TIM_frequency = timer_tick_frequency / (TIM_Period + 1)

s (to ms) s to ms= 1 ms

Hz Freq to Period= 0.001 s s to ms= 1 ms

Hz Timer_tick_frequency =  TIM_frequency * (TIM_Period + 1)


Hz

prescaller_se = (Timer_default_frequency / timer_tick_frequency) - 1 

TIM_Period = (timer_tick_frequency / TIM_frequency) - 1

Desired Freq = 1 Hz
Period to Freq = 1s

Desired Period = 400 ms


Freq to Period = 2.5 Hz

You might also like