25.2.2.4 Timer/Counter Reloading

The TCC also has a configurable reload action, used when a re-trigger event occurs. Examples of a re-trigger event could be the counter reaching the maximum value when counting up, or when an event from the event system makes the counter to re-trigger. The reload action determines if the prescaler should be reset, and on which clock. The counter will always be reloaded with the value it is set to start counting. The user can choose between three different reload actions, described in Table 25-3.

Table 25-3. TCC Module Reload Actions

Reload action

Description

TCC_RELOAD_ACTION_GCLK

Reload TCC counter value on next GCLK cycle. Leave prescaler as-is.

TCC_RELOAD_ACTION_PRESC

Reloads TCC counter value on next prescaler clock. Leave prescaler as-is.

TCC_RELOAD_ACTION_RESYNC

Reload TCC counter value on next GCLK cycle. Clear prescaler to zero.

The reload action to use will depend on the specific application being implemented. One example is when an external trigger for a reload occurs; if the TCC uses the prescaler, the counter in the prescaler should not have a value between zero and the division factor. The counter in the TCC module and the counter in the prescaler should both start at zero. If the counter is set to re-trigger when it reaches the maximum value, this is not the right option to use. In such a case it would be better if the prescaler is left unaltered when the re-trigger happens, letting the counter reset on the next GCLK cycle.