Arduino Zero TCC Capture

Hi Daniel,

The changes shouldn't be necessary, I tested the TCC1, single slope PWM example #94 above and I'm getting 40kHz, 50% duty-cycle on D9.

In your code, you've done the same thing, but configured the output for dual slope PWM instead.

The TCC1 timer output isn't available on D7. Your next best option is to use D8 that can output TCC1 on channel 0.

To activate D8, change the pin multiplexer (PMUX) configuration to:

PORT->Group[g_APinDescription[8].ulPort].PMUX[g_APinDescription[8].ulPin >> 1].reg |= PORT_PMUX_PMUXE_E;

You'll also need to change the counter compare register to channel 0:

REG_TCC1_CC0 = 599;      // Set the duty cycle of the PWM on TCC1 to 50%
while(TCC1->SYNCBUSY.bit.CC0);

You'll need to set it to 299 if you're using dual slope PWM.

Kind regards,
Martin