25.8.6 Quick Start Guide for TCC - Recoverable Fault

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

In this use case, the TCC will be used to generate a PWM signal, with a varying duty cycle. Here the pulse width is increased each time the timer count matches the set compare value. There is a recoverable faul input which controls PWM output, when this fault is active (low) the PWM output will be frozen (could be off or on, no light changing). When fault is released (input high) the PWM output then will go on.

When connect PWM output to LED it makes the LED vary its light. If fault input is from a button, the LED will be frozen and not changing it's light when the button is down and will go on when the button is up. To see the PWM waveform, you may need an oscilloscope.

The PWM output and fault input is set up as follows:

Board

Pin

Connect to

SAMD21 Xpro

PB30

LED0

SAMD21 Xpro

PA15

SW0

SAMR21 Xpro

PA06

EXT1 Pin 3

SAMR21 Xpro

PA28

SW0

SAML21 Xpro

PB10

LED0

SAML21 Xpro

PA16

SW0

SAML22 Xpro

PB18

EXT3 Pin 9

SAML22 Xpro

PC01

SW0

SAMDA1 Xpro

PB30

LED0

SAMDA1 Xpro

PA15

SW0

SAMC21 Xpro

PA15

LED0

SAMC21 Xpro

PA28

SW0

The TCC module will be set up as follows:
  • GCLK generator 0 (GCLK main) clock source

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

  • No dithering on the counter or compare

  • No prescaler

  • Single Slope PWM wave generation

  • GCLK reload action

  • Don't run in standby

  • No waveform extentions

  • No inversion of waveform output

  • No capture enabled

  • Count upward

  • Don't perform one-shot operations

  • No event input except channel 0 event enabled

  • No event action

  • No event generation enabled

  • Counter starts on 0

  • Recoverable Fault A is generated from channel 0 event input, fault halt acts as software halt, other actions or options are all disabled