24.2.4.3 Reloading

Timer modules also contain a configurable reload action, used when a re-trigger event occurs. Examples of a re-trigger event are the counter reaching the maximum value when counting up, or when an event from the event system tells the counter to re-trigger. The reload action determines if the prescaler should be reset, and when this should happen. The counter will always be reloaded with the value it is set to start counting from. The user can choose between three different reload actions, described in Table 24-3.

Table 24-3. TC Module Reload Actions

Reload action

Description

TC_RELOAD_ACTION_GCLK

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

TC_RELOAD_ACTION_PRESC

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

TC_RELOAD_ACTION_RESYNC

Reload TC 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 TC uses the prescaler, the counter in the prescaler should not have a value between zero and the division factor. The TC counter and the counter in the prescaler should both start at zero. When the counter is set to re-trigger when it reaches the maximum value on the other hand, 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.