Comparing External Interrupts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Comparing External Interrupts

832 Views
thomasolenik
Contributor III

I'm working on a project using the KEA128 where I need to read a shaft encoder. Using the FRDM-KEA128 board, I'm successfully measuring the time between edges of the signal using the PWT, but I also want to count them. If I'm reading the documentation correctly, there seem to be several ways to trigger an external interrupt with the KEA128 to increment this counter. In order of priority these are:

NMI

IRQ

ACMP

KBI

The NMI is the highest priority, but it is only active low.

IRQ is the next highest priority, and it can be configured to detect rising or falling edges as well as levels.

ACMP is next in priority, and it can be used to trigger on a voltage level.

The KBI is the lowest priority of these options but it can read multiple inputs which are stored in the KBIx_SP register.

Did I miss any differences? It seems like the IRQ is the one I'm looking for, but wanted to see if there were other ideas out there.

Thanks ahead of time for any additional info.

Labels (1)
Tags (1)
0 Kudos
3 Replies

408 Views
egoodii
Senior Contributor III

If there is ANY chance of 'bounce' in the encoder edges (including runt pulses), then the 'interrupt on edges' technique will ALWAYS be in danger of 'losing' edges.  Shaft encoders are 'slow enough' that a simple 'poll' technique will do very nicely.

FTM0 Quadrature decoder

  Of course many Kinetis members have full quadrature interfaces for some counter blocks.

0 Kudos

408 Views
thomasolenik
Contributor III

Earl,

Thanks for the the response. I didn't mention that I'm using a VR sensor into a zero crossing detection circuit with hysteresis built in. So I think its safe from debounce and pretty good noise immunity.

Since posting this, I also see that the PWT has the ability to trigger interrupts as well and that might be a more efficient use of pins. There seem to be two types of interrupts that the PWT can generate. However, the RM for the KEA128 is a little vague on the difference between the two. Well, there are three actually, but only two might apply to this use case.

PWTIE - PWT Module Interrupt Enable

PRDYIE - PWT Pulse Width Data Ready Interrupt Enable

Maybe I'm splitting hairs, but I would really like to understand the differences better.

Thanks,

Tom

0 Kudos

408 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas,

After had a look through the statement, I'm still a little bit confused with your issue.

In my opinion, you already used the PWT module to measure the period or width of the PWM signals indirectly.

So I was wondering if you can clarify it.

About the PWT interrupt trigger sources, if PWT_R2[PWTC] runs from 0xFFFF to 0x0000, the PWTOV bit is set.

And if the PWT captures the width of pulse, the PWT_R1[PWTRDY] bit is set.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos