It appears not possible to me.
This stops outputting a toggle if both MPWM wavegen is enabled and the CC0 interrupt is enabled. Either by itself the timer keeps going.
What I want to do is output a pulse train to a stepper motor without any jitter caused by interrupts through a wavegen output. Then count them
inside the interrupt when it fires to keep count. The count can be jittery and even one or two off in error. Just need the output waveform solid. That is why I can't toggle the lines inside the interrupt.
REG_TC6_CTRLBSET = TC_CTRLBSET_CMD_READSYNC;
while(REG_TC6_SYNCBUSY & TC_CTRLBSET_MASK);
if(REG_TC6_COUNT16_COUNT > 500)DEBUG_LINE_HIGH(); // no output on scope if both wavegen and int enabled
else
DEBUG_LINE_LOW();
Can I use the wavegen feature and output events for an interrupt source?
Setup code ..
REG_TC6_CTRLA = 0; // reset
while(REG_TC6_SYNCBUSY & TC_SYNCBUSY_ENABLE);
REG_TC6_CTRLA = TC_CTRLA_MODE_COUNT16;
REG_TC6_COUNT16_CC0 = 10000; //
while(REG_TC6_SYNCBUSY & TC_SYNCBUSY_MASK); //
REG_TC6_COUNT16_CC1 = 5000; //
while(REG_TC6_SYNCBUSY & TC_SYNCBUSY_MASK); //
REG_TC6_WAVE = TC_WAVE_WAVEGEN_MPWM;
// REG_TC6_INTENSET = TC_INTENSET_MC0;
REG_TC6_CTRLA |= TC_CTRLA_ENABLE;
while(REG_TC6_SYNCBUSY & TC_SYNCBUSY_MASK);
Thanks