I'm using timers D0 and D1 in cascaded mode, to have a 32-bit counter:
EVSYS.CH0MUX = EVSYS_CHMUX_TCD0_OVF_gc; TC_EnableEventDelay(&TCD1); TC1_ConfigClockSource(&TCD1, TC_CLKSEL_EVCH0_gc); TC0_ConfigClockSource(&TCD0, TC_CLKSEL_DIV1_gc);
when a criteria is met, I need to restart the counter, that is to reset it to 0, losing as little time as possible.
Because TCD0 is the least significant timer and TCD1 the most one, I think to reset first TCD0, then TCD1.
From the datasheet I'm not sure if I can just write the CNT register even if the time is running or I need to stop it first.