23.3.4.6 High Resolution

The high resolution can be used to increase the resolution of the waveform generation output from a timer/counter by four or eight. It can be used for a timer/counter doing frequency, Single-Slope PWM, or Dual-Slope PWM generation. It can also be used with the WEX if used for the same timer/counter.

The high-resolution extension uses a clock source of 4x: In 4x mode, the rising edges are counted, and to obtain 8x, both edges are counted.

Figure 23-13. Timer/Counter with High-Resolution Extension

When the high-resolution extension is enabled, the timer/counter must run from a non-prescaled peripheral clock.

For full utilization of high-resolution, a clock running at 4x the desired CPU speed must be available. If the desired system speed is 20 MHz, then Phase Locked Loop (PLL) must be enabled for the system (PLL must be selected in MCLKCTRL.CLKSEL to obtain an 80 MHz source) and enable PRESCB (MCLKCTRL.PBDIV). This results in an 80 MHz source for high-resolution and 20 MHz for the system clock/peripheral clock.

The Timer/Counter will ignore its least significant bits (LSb) in the counter, according to selection in the High Resolution Enable (HREN[1:0]) bit field in the Control D (TCEn.CTRLD) register. Overflow/underflow and compare match of the most significant bits (MSb) is done in the timer/counter. Count and compare the LSb is handled and compared in the hi-res extension running from the clock operating at 4x or 8x the system clock.

Figure 23-14 shows that only one edge of the PWM is affected when high resolution is enabled, and it is the LSbs of the compare register that define the fraction of CLK_PER:

Figure 23-14. Duty Cycle Control

Since the LSbs are unused for the period, the PWM frequency will change when high resolution is enabled. See Table 23-4.

Table 23-4. High-Resolution Influence on Counter and Waveform
HRENLSbs used for Hi-ResCounter inc/decfFRQfSSfDS
OFF0±1fCLK_PER2N(CMP0+1)fCLK_PERN(PER+1)fCLK_PER2N(PER)
4X2±44fCLK_PER2N(CMP0+4)4fCLK_PERN(PER+4)4fCLK_PER2N(PER)
8X3±88fCLK_PER2N(CMP0+8)8fCLK_PERN(PER+8)8fCLK_PER2N(PER)

The LSbs of the timer/counter period register must be set to zero to ensure correct operation. If the count register is read from the application code, the LSb will always be read as zero since the timer/counter runs from the peripheral clock. The LSbs are also ignored when generating events.

The TCE in High Resolution mode will not output any pulse shorter than one peripheral clock cycle; i.e., a compare value lower than four will have no visible output.