MOD5234 eTPU Quadrature encoder QD position counter interrup

Discussion to talk about software related topics only.
Post Reply
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

MOD5234 eTPU Quadrature encoder QD position counter interrup

Post 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
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Post by barttech »

Maybe I' ve got it, I needed to use
eTPUEventClear(channel);
in my ISR, not disable/enable.
I think??
Sam
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Post 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
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Post by dciliske »

I'll try to pass this along... I definitely don't know the answer to that.
Dan Ciliske
Project Engineer
Netburner, Inc
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: MOD5234 eTPU Quadrature encoder QD position counter inte

Post 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
Post Reply