Overview

Timer/Counter Overview

The flexible 16-bit TCE provides an accurate program execution timing, frequency and waveform generation, and command execution.

A TCE instance consists of a base counter and four compare channels. Based on the clock ticks (timer) or different events (counter), the base counter can be set by the user to count upwards or downwards. A timer/counter can be clocked and timed from the peripheral clock, with optional prescaling, or from the EVSYS. The EVSYS can also be used for direction control or to synchronize operations.

The counter includes a high-resolution option that can increase the duty cycle resolution up to eight times of the input clock. Additionally, a prescaled peripheral clock and events from the EVSYS can be used to control the counter.

Figure . Timer/Counter Block Diagram

The counter value is continuously compared to zero and the period (PER) value to determine when the counter has reached BOTTOM or TOP, respectively. If one of the conditions is met, the counter is updated, and an interrupt is generated. The counter is also compared with the Compare registers. The counter uses these comparisons to generate interrupts and set the waveform and period of the pulse-width, if a Waveform Generation mode is selected.

The Counter, Period, and Compare registers and all their buffers are 16-bits wide. The buffers are part of a scheme that ensures the respective registers are updated only when the Counter register is updated. Each buffer has a Buffer Valid (BV) bit used to determine if the respective register requires updates.

The TCE can be configured to use the EVSYS to count the rising and/or falling edges of the event signal or use it to enable clock ticks counting.

TCE offers the option of writing a fractional value between 0 and 2 to the compare registers, if the SCALEMODE option is enabled. The compare value is calculated based on the period, amplitude, and offset values.

Waveform Extension Overview

The WEX provides extra functions to the timer/counter in Waveform Generation (WG) modes, such as complementary signal generation with dead time. This functions are helpful for motor control and power control applications.

A WEX instance consist of five independent units:
  • Input matrix
  • Dead time insertion unit
  • Swap unit
  • Pattern generation unit
  • Fault protection unit
The user can route out the waveform outputs from the timer/counter to the port pins in different configurations when using the input matrix unit. The dead time insertion unit can split the timer’s four outputs into two non-overlapping signals, low-side and high-side. The WEX can make eight PWM output signals from the timer’s four PWM output signals. The low-side and high-side pin positions can be swapped using the swap unit, an important feature for fast motor decay. Pattern generation unit can override the port pins with constant logic level. Pattern generation unit can be used independently of the timer/counter. The user can configure a pattern for the maximum eight pins. The fault protection unit can set the WEX outputs to a defined state in case of fault detection. The fault protection unit is connected to the EVSYS, enabling the events to trigger faults.
Figure . Waveform Extension Block Diagram