I have TC7 clocked with XOSC32K (32768 Hz) and CPU + almost all other peripherals running @40MHz.
I have just found that reading of TC7.COUNT is terribly slow.
TC7 is configured to automatically synchronize COUNT value and reading it done via:
wa = ((TcCount16 *)TC7)->COUNT.reg; // 16b Read
I have measured this Read takes about 6 periods of the generic clocks used, i.e. 6x 30.5us = 180us.
The fact that synchronization takes approx. 5-6 periods of generic clocks is described in datasheet - as I found now, too late.
Blocking other tasks for such a long time is unacceptable in my app.
Is there any method that would enable me to use accurate 32768 Hz clocks for some of the TC counters
and read the current counter state quickly (in <1us, CPU tick is 25ns..) ?
I have only one idea on mind - to configure the TC7 to count to 15 (for example) => would serve as prescaller /16, and timer-match-INTerrupts would increment SW-counter (that can be read with no delay).
But this is a bit clumsy as counting would stop when I switch to Standby.