ePWM
7 - 22 TMS320F2837xD Microcontroller Workshop - Control Peripherals
Asymmetric and Symmetric Waveform Generation
using the ePWM
PWM switching frequency:
The PWM carrier frequency is determined by the value contained in the time-base period register,
and the frequency of the clocking signal. The value needed in the period register is:
Asymmetric PWM:
1
periodtimer
period
switching
register period −
=
Symmetric PWM:
period)2(timer
period switching
register period =
Notice that in the symmetric case, the period value is half that of the asymmetric case. This is
because for up/down counting, the actual timer period is twice that specified in the period register
(i.e. the timer counts up to the period register value, and then counts back down).
PWM resolution:
The PWM compare function resolution can be computed once the period register value is
determined. The largest power of 2 is determined that is less than (or close to) the period value.
As an example, if asymmetric was 1000, and symmetric was 500, then:
Asymmetric PWM: approx. 10 bit resolution since 2
10
= 1024 ≈ 1000
Symmetric PWM: approx. 9 bit resolution since 2
9
= 512 ≈ 500
PWM duty cycle:
Duty cycle calculations are simple provided one remembers that the PWM signal is initially
inactive during any particular timer period, and becomes active after the (first) compare match
occurs. The timer compare register should be loaded with the value as follows:
Asymmetric PWM:
TxPR cycle)duty - (100% = TxCMPR ∗
Symmetric PWM:
TxPR cycle)duty - (100% = TxCMPR ∗
Note that for symmetric PWM, the desired duty cycle is only achieved if the compare registers
contain the computed value for both the up-count compare and down-count compare portions of
the time-base period.