Page 1 of 1

MOD5234 eTPU Quadrature encoder QD position counter interrup

Posted: Fri Jun 06, 2014 9:29 am
by barttech
Hi,
I'm trying to get my encoder to generate an interrupt when it reaches a certain position.
I want to use
fs_etpu_qd_set_pc_interrupts(chan, pc1, pc2)
but I can't find good documentation on it, here or at Freescale.
I either get no interrupts, or one correct interrupt, then can't stop the interrupts.

My questions are:
1) Does it generate an interrupt when the pc gets to either pc1 OR pc2?
2) Does it have to hit exactly?
3) Does it know which way I intend to go, given where I am, so that is doesn't start interrupts immediately?
4) Or does it generate an interrupt when it is between pc1 and pc2?
or what?

I've tried using both
eTPUInterruptEnable(EncoderChannel);
eTPUInterruptDisable(EncoderChannel);
and
fs_etpu_qd_enable_pc_interrupts(EncoderChannel);
fs_etpu_qd_disable_pc_interrupts(EncoderChannel);
Do I need all of them, or only one pair, and if just one, which one?

Do I need to disable the interrupt in the ISR with one of the disable commands above? Or is there a better way to turn it on and off?

Thanks!
Sam

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Posted: Fri Jun 06, 2014 10:19 am
by barttech
Maybe I' ve got it, I needed to use
eTPUEventClear(channel);
in my ISR, not disable/enable.
I think??
Sam

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Posted: Fri Jun 06, 2014 11:07 am
by barttech
So I guess my question boils down to:
What is the purpose of the second value pc2 in
fs_etpu_qd_set_pc_interrupts(chan, pc1, pc2)
?
Sam

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Posted: Fri Jun 06, 2014 12:05 pm
by dciliske
I'll try to pass this along... I definitely don't know the answer to that.

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Posted: Fri Jun 13, 2014 2:06 pm
by barttech
Freescale Tech support says that if the QD sees either pc1 or pc2 it will set an interrupt. I guess this could be useful if you didn't know which way you were going. I guess I can use it as a fall back value, set it to 4 steps beyond my desired target in case it misses the first one.
Sam