0
\$\begingroup\$

I am writing firmware for an ATXmega. I have a timer configured in single-slope mode to output a PWM signal. I need one of the xmega's event channels to trigger in the middle of that signal. I thought I had it configured to do so, but I am suspecting that the event is actually triggering off of the period.

Some representative example C code:

TCF1.PER = 100;
TCF1.CCA = 20;
TCF1.CTRLA = TC_CLKSEL_DIV1_gc;     // timer will not run until this line
TCF1.CCB = 100/2; // middle of the waveform
TCF1.CTRLB = TC_WGMODE_SINGLESLOPE_gc | SWITCHING_SIGNAL_CHANNEL_ENABLE; // enable timer output to pin
// ... and then later ...
EVSYS.CH7MUX = EVSYS_CHMUX_TCF0_CCB_gc;

And then an diagram showing the situation and the desired and undesired behaviour of the event channel:

How do I get the event channel to behave in the desired way, and then verify that it is not behaving in the undesired way?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

After testing with an independent test setup, I was able to confirm that the above code does indeed create the desired behaviour in the event channel.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.