Tcc Pwm Block Icon
Timer/Counter for Control (TCC) PWM peripheral for SAM microcontrollers. Features advanced pattern generation, complementary outputs with dead-time, and fault protection for motor control.

TCC Instance Availability

FamilyTCC InstancesChannels per TCC
SAME54/53/51TCC0, TCC1, TCC26, 4, 3 channels
SAMC21/20TCC0, TCC1, TCC24, 4, 2 channels
SAMD21/20TCC0, TCC1, TCC24, 2, 2 channels

Supported Device Families

  • SAM E5x
  • SAM D5x
  • SAM C2x

Key Features

  • Up to 6 PWM channels per TCC instance (device dependent)
  • Complementary outputs with dead-time
  • Circular, dual-slope (center-aligned) modes
  • Pattern generation for BLDC/stepper motors
  • Recoverable and non-recoverable faults
  • Dithering for enhanced resolution
  • Compare capture for position sensing

Configuration Parameters

Configuration

ParameterDescription
TCC_InstanceSelect TCC0, TCC1, or TCC2
Waveform_ModeNormal Frequency, Match Frequency, or PWM
Counter_ModeUp, Down, or Dual-slope (center-aligned)
Enabled_ChannelsArray of enabled channel numbers

Dead Time and Pattern

ParameterDescription
DeadTime_EnableEnable complementary output with dead-time
DeadTime_LowDead-time for low-side (cycles)
DeadTime_HighDead-time for high-side (cycles)
Pattern_EnableEnable pattern generator for BLDC
Pattern_TableCommutation pattern table

Block Inputs/Outputs

Inputs

InputDescription
PeriodOptional period input
Compare 0..NCompare values (duty cycle) per channel
Pattern_IndexPattern table index (if pattern mode enabled)

Outputs

OutputDescription
Fault_StatusFault condition status
Overflow_FlagCounter overflow indicator

Usage Example

% BLDC motor control with TCC pattern generator:
TCC_Instance = 'TCC0';
Waveform_Mode = 'PWM';
Counter_Mode = 'Dual-slope';
Enabled_Channels = [0 1 2];

% Pattern generator:
Pattern_Enable = 'on';
Pattern_Table = [
    % Hall state -> [Ch0 Ch1 Ch2] outputs
    0b000000;  % Invalid
    0b100001;  % Hall 001
    0b001100;  % Hall 010
    0b101100;  % Hall 011
    0b110010;  % Hall 100
    0b110001;  % Hall 101
    0b011010;  % Hall 110
    0b000000   % Invalid
];

% Connect Hall sensor state -> Pattern_Index
  • MCHP_PWM_SAM7x - General SAM7x PWM
  • MCHP_TC_PWM - Timer/Counter PWM
  • MCHP_ADC_SAM - SAM ADC with TCC event sync