9.9.6.6 Trigger Events

Input Events

An input trigger event resets the internal counter value and starts the counter clock. Three types of trigger are common to both modes, and an external trigger is available to each mode (Capture or Waveform).

Regardless of the input trigger event used, it will be taken into account at the following active edge of the selected clock. This means that the counter value can be read differently from zero just after a trigger event, especially when a low frequency signal is selected as the clock.

The following input trigger events are common to both modes:
  • Software trigger: Each channel has a software trigger, available by setting TC_CCR.SWTRG.
  • SYNC: Each channel has a synchronization signal SYNC. When asserted, this signal has the same effect as a software trigger. The SYNC signals of all channels are asserted simultaneously by writing TC_BCR with SYNC set.
  • Compare RC trigger: RC is implemented in each channel and can provide a trigger when the counter value matches the RC value if TC_CMRx.CPCTRG is set.

The timer channel can also be configured to be triggered by an external event.

In Capture mode, the external trigger signal can be selected between TIOAx and TIOBx.

In Waveform mode, an external event can be programmed on one of the following signals: TIOBx, XC0, XC1 or XC2. This external event can then be programmed to perform a trigger by setting TC_CMRx.ENETRG.

If an external trigger event is used, the duration of the pulses must be longer than the peripheral clock period to be detected.

Output Events

The internal counter and associated comparators provide generic trigger events for DMA transfers. These trigger events are selected in the DMA peripheral (refer to the section “DMA Controller”).

Three events correspond to the capture and compare events for which status flags CPAS, CPBS and CPCS are provided in TC_SRx.

One event corresponds to the detection of an edge on either the TIOA, TIOB or TCLK0/1/2 input depending on operating mode and configuration, for which the ETRGS status flag is provided in TC_SRx.

The status flags are cleared by software whereas the compare events setting the corresponding flags are pulses of one clock period only.

Figure 9-270. TC Output Trigger Events for DMA

When triggered by the TC output events, the DMA can perform any access allowed in the system memory, including accesses to TC when configured in Capture mode (see Transferring Timer Values with DMAC in Capture Mode).