Dual-slope PWM

For dual-slope PWM generation, the period (T) is controlled by TCA.PER, while the values of TCA.CMPn control the duty cycle of the WG output.

The figure below shows how for dual-slope PWM the counter counts repeatedly from BOTTOM to TOP and then from TOP to BOTTOM. The waveform generator output is set on BOTTOM, cleared on compare match when up-counting, and set on compare match when down-counting.

Figure 1. Dual-slope Pulse Width Modulation

Using dual-slope PWM results in a lower maximum operation frequency compared to the single-slope PWM operation.

The period register (TCA.PER) defines the PWM resolution. The minimum resolution is 2 bits (TCA.PER=0x0003), and the maximum resolution is 16 bits (TCA.PER=MAX).

The following equation calculate the exact resolution for dual-slope PWM (RPWM_DS):


The PWM frequency depends on the period setting (TCA.PER), the peripheral clock frequency (fCLK_PER), and the prescaler divider used (CLKSEL in TCA.CTRLA). It is calculated by the following equation:


N represents the prescaler divider used.