Overview

Timer/Counter Overview

The flexible 16-bit TCE provides accurate program execution timing, frequency and waveform generation, as well as 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 user can set the base counter 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 operation synchronization.

The counter includes a high-resolution option which can increase the duty cycle resolution to eight times 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 only updated 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 tick 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. These functions are helpful for motor control and power control applications.

A WEX instance consists 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 four PWM output signals of the timer. The low-side and high-side pin positions can be swapped using the swap unit, an important feature for fast motor decay. The pattern generation unit can override the port pins with a constant logic level, and may be used independently of the timer/counter. The user can configure a pattern for a maximum of eight pins. The Fault protection unit can set the WEX outputs to a defined state when a Fault event is detected. The Fault protection unit is connected to the EVSYS, enabling the events to trigger faults.
Figure . Waveform Extension Block Diagram