Arduino Zero TCC Capture

Hi Daniel,

1 / Has AttachInterrupt with NULL being repaired in the IDE 1.8.5 ? If not I need to put a callback routine as previously isn't it ?

I raised the issue with the Arduino SAMD core development team and they've flagged it as a bug, so I expect it might be fixed in a subsequent Arduino Zero build.

In the DMAC example code above, I commented out attachInterrupt() function and replaced it by setting the interrupt registers directly.

2/ How can I know that a new period has been measured in your sketch, since there is no more "void TCC0_Handler()" ?

The "dmacPeriod" and "dmacPulsewidth" variables now hold the latest measurements. The DMAC is reading them instead of the CPU having service the TCC0_Handler() each time. The DMAC is effectively handling the TCC0 timer for the CPU.

3/ I also need "Count" data for my application. Can I declare isrCount variable and put isrCount++; in the void loop, but as said in 2/ above, how can I increment it at the end of each period measurement ?

I'll have to think about this one....

It might be possible to use the event system to get another of the SAMD21's timers to count the number of TCC0 periods that have elapsed.

Kind regards,
Martin