23.4.2 Operation

The following definitions are used throughout the documentation:

Table 23-2. Timer/Counter for Control Applications - Definitions
NameDescription
TOPThe counter reaches TOP when it becomes equal to the highest value in the count sequence. The TOP value can be the same as Period (PER) or the Compare Channel 0 (CC0) register value depending on the waveform generator mode in the Waveform Output Generation Operations section.
ZEROThe counter reaches ZERO when it contains all zeroes
MAXThe counter reaches maximum when it contains all ones
UPDATEThe timer/counter signals an update when it reaches ZERO or TOP, depending on the direction settings
TimerIncrement / decrement / clear / reload steps are done on each prescaled clock
CounterIncrement / decrement / clear / reload steps is done on each detected events
CCnCapture/Compare channel n based on operation mode
MCnMatch/Compare channel n based on operation mode
CC_NUMThe number of Compare/Capture channels
WO_NUMThe number of Waveform Outputs

Each TCC instance has up to four Compare/Capture channels (CCn).

The Period register (PER), the Compare/Capture Channel n register (CCn) and the Pattern register (PATT) have buffered versions in the Period Buffer register (PERBUF), the Compare/Capture Buffer Channel x register (CCBUFx) and the Pattern Buffer register (PATTBUF). Each buffer register has a buffer valid flag in the Status register (STATUS) that indicates when the buffer contains a new value.

Under normal operation, the counter value is continuously compared to the TOP or ZERO value to determine whether the counter has reached TOP or ZERO. In either case, the TCC can generate interrupt requests, request Direct Memory Access (DMA) transactions, or generate events for the Event System. In waveform generator mode, these comparisons are used to set the waveform period or pulse alignment.

A prescaled generic clock (GCLK_TCCn) and events from the event system can be used to control the counter. The event system is used as a source for the input capture.

The Recoverable Fault Unit enables event controlled waveforms by acting directly on the generated waveforms of the TCC compare channels output. These events can restart, halt the timer/counter period, shorten the output pulse active time, or disable waveform output as long as the fault condition is present. This can typically be used for current sensing regulation, zero-crossing and demagnetization retriggering.

The MCE0 and MCE1 (Match or Capture Channel) asynchronous event sources are shared with the Recoverable Fault Unit. Only asynchronous events are used internally when fault unit extension is enabled. For further details on how to configure asynchronous events routing, refer to the EVSYS - Event System section.

Recoverable fault sources can be filtered and/or windowed to avoid false triggering, for example from I/O pin glitches, by using digital filtering, input blanking, and qualification options. See also the Recoverable Faults section.

To support different applications the following additional features are implemented in some or all of the TCC instances as optional and successive units:
  • Recoverable faults and non-recoverable faults
  • Output matrix
  • Pattern generation
See the Overview section for more information on which TCC instance has additional features, and the Block Diagram section for how the additional features connect.

The output matrix (OTMX) can distribute and route the TCC waveform outputs across the port pins in different configurations, each optimized for different application types.

The pattern generation unit can be used to generate synchronized waveforms with a constant logic level on TCC UPDATE conditions. This is useful for easy stepper motor and full bridge control.

The non-recoverable fault module enables event controlled fault protection by acting directly on the generated waveforms of the timer/counter compare channel outputs. When a non-recoverable fault condition is detected, the output waveforms are forced to a per-configured value that is safe for the application. This is typically used for instant and predictable shutdown and disabling high-current or high-voltage drives.

The count event sources (TCE0 and TCE1) are shared with the non-recoverable fault extension. The events can be optionally filtered.

Note: MCE0 and MCE1 can also be used as non-recoverable event source.

If the filter options are not used, the non-recoverable faults provide an immediate asynchronous action on waveform output, even for cases where the clock is not present. For further details on how to configure asynchronous events routing, refer to the EVSYS - Event System section.