Edge Aligned PWM
When configured for edge-aligned mode, a module generates an edge transition at two points for every 2
N
PCA clock cycles, where N
is the selected PWM resolution in bits. In edge-aligned mode, these two edges are referred to as the “match” and “overflow” edges. The
polarity at the output pin is selectable and can be inverted by setting the appropriate channel bit to 1 in the PCA0POL register. Prior to
inversion, a match edge sets the channel to logic high, and an overflow edge clears the channel to logic low.
The match edge occurs when the the lowest N bits of the module’s PCA0CPn register match the corresponding bits of the main PCA0
counter register. For example, with 10-bit PWM, the match edge occurs any time bits 9-0 of the PCA0CPn register match bits 9-0 of the
PCA0 counter value.
The overflow edge occurs when an overflow of the PCA0 counter happens at the desired resolution. For example, with 10-bit PWM, the
overflow edge occurs when bits 0-9 of the PCA0 counter transition from all 1s to all 0s. All modules configured for edge-aligned mode at
the same resolution align on the overflow edge of the waveforms.
An example of the PWM timing in edge-aligned mode for two channels is shown here.
0xFFFF
0x0000
0x0001
0x0002
0x0003
0x0004
0x0005
Counter (PCA0)
0x0001
Capture / Compare
(PCA0CP0)
Output (CEX0)
PCA Clock
match edge
overflow edge
0x0005
Capture / Compare
(PCA0CP1)
Output (CEX1)
match edge
Figure 17.6. Edge-Aligned PWM Timing
For a given PCA resolution, the unused high bits in the PCA0 counter and the PCA0CPn compare registers are ignored, and only the
used bits of the PCA0CPn register determine the duty cycle. A 0% duty cycle for the channel is achieved by clearing the module’s
ECOM bit to 0. This will disable the comparison, and prevent the match edge from occuring.
Note:
Although the PCA0CPn compare register determines the duty cycle, it is not always appropriate for firmware to update this regis-
ter directly. See the sections on 8 to 11-bit and 16-bit PWM mode for additional details on adjusting duty cycle in the various modes.
Duty Cycle =
2
N
- PCA0CPn
2
N
Figure 17.7. N-bit Edge-Aligned PWM Duty Cycle (N = PWM resolution)
EFM8SB2 Reference Manual
Programmable Counter Array (PCA0)
silabs.com
| Smart. Connected. Energy-friendly.
Rev. 0.1 | 172