The frequency of PWM events is controlled by the time-base period (TBPRD) register and the mode of the time-base counter. Figure 14-6 shows the period (Tpwm) and frequency (Fpwm) relationships for the up-count, down-count, and up-down-count time-base counter modes when the period is set to 4 (TBPRD = 4). The time increment for each step is defined by the time-base clock (TBCLK) which is a prescaled version of the ePWM clock (EPWMCLK).
The time-base counter has three modes of operation selected by the time-base control register (TBCTL):
- Up-Down Count Mode: In up-down count mode,
the time-base counter starts from zero and increments until the period (TBPRD)
value is reached. When the period value is reached, the time-base counter then
decrements until the counter reaches zero. At this point, the counter repeats
the pattern and begins to increment.
- Up-Count Mode: In up-count mode, the
time-base counter starts from zero and increments until the counter reaches the
value in the period register (TBPRD). When the period value is reached, the
time-base counter resets to zero and begins to increment once again.
- Down-Count Mode: In down-count mode, the
time-base counter starts from the period (TBPRD) value and decrements until the
counter reaches zero. When the counter reaches zero, the time-base counter is
reset to the period value and begins to decrement once again.