20.3.3.4.2 Frequency (FRQ) Waveform Generation

For frequency generation, the period time (T) is controlled by a TCAn.CMPn register instead of the Period register (TCAn.PER). The waveform generation output WG is toggled on each compare match between the TCAn.CNT and TCAn.CMPn registers.

Figure 20-9. Frequency Waveform Generation

The waveform frequency (fFRQ) is defined by the following equation:

f FRQ = f CLK_PER 2 N ( CMPn + 1 )

where N represents the prescaler divider used (CLKSEL in TCAn.CTRLA), CMPn is the value of the TCAn.CMPn register, and fCLK_PER is the system clock for the peripherals.

The maximum frequency of the waveform generated is half of the peripheral clock frequency (fCLK_PER/2) when TCAn.CMPn is written to zero (0x0000) and no prescaling is used (N=1, CLKSEL=0x0 in TCAn.CTRLA).