25.8.3 Quick Start Guide for TCC - Timer

The supported board list:
  • SAM D21/R21/L21/L22/DA1/C21 Xplained Pro

  • SAM D11 Xplained Pro

In this use case, the TCC will be used as a timer, to generate overflow and compare match callbacks. In the callbacks the on-board LED is toggled.

The TCC module will be set up as follows:
  • GCLK generator 1 (GCLK 32K) clock source

  • Use double buffering write when set top, compare, or pattern through API

  • No dithering on the counter or compare

  • Prescaler is divided by 64

  • GCLK reload action

  • Count upward

  • Don't run in standby

  • No waveform outputs

  • No capture enabled

  • Don't perform one-shot operations

  • No event input enabled

  • No event action

  • No event generation enabled

  • Counter starts on 0

  • Counter top set to 2000 (about 4s) and generate overflow callback

  • Channel 0 is set to compare and match value 900 and generate callback

  • Channel 1 is set to compare and match value 930 and generate callback

  • Channel 2 is set to compare and match value 1100 and generate callback

  • Channel 3 is set to compare and match value 1250 and generate callback