21.3.3.3 Changing the Period
The Counter period is changed by writing a new TOP value to the Period register (TCAn.PER).
No Buffering: If double buffering is not used, any period update is immediate.
A counter wraparound
can occur in any mode of operation when up-counting without buffering.
This is due to the fact that the TCAn.CNT and TCAn.PER registers are
continuously compared: if a new TOP value is written to TCAn.PER that
is lower than current TCAn.CNT, the counter will wrap first, before a
compare match happens.
With Buffering:
When double buffering is used, the buffer can be written at any time
and still maintain correct operation. The TCAn.PER is always updated on
the UPDATE condition, as shown for dual-slope operation in the figure
below. This prevents wraparound and the generation of odd
waveforms.