KL17Z GPIO interrupt issue

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

KL17Z GPIO interrupt issue

612 Views
dhananjayjoshi
Contributor I

Hello,

We are using MKL17Z controller (CM0+ core) in our project. The PORTA pin 13 is configured as digital input with negative edge interrupt. The interrupt is generated on falling edge by an external square wave of 60Hz applied to the pin 13. After entering the ISR the PORTA_ISFR bit 13 is SET immediately so as to clear the interrupt flag. I checked the ISR operation by toggling a pin. The ISR works fine for most of the time but sporadically the control enters the ISR even on positive edge. This is somthing strange! I have ensured that the interrupt configuration is not changed in the code at any time. Has anybody faced such problem?

Regards,

DJay

0 Kudos
4 Replies

523 Views
rastislav_pavlanin
NXP Employee
NXP Employee

Hello DJay,

I would recommend to check whether each of the edge in 60Hz square wave is really without any fast oscilations first. It can happend that due to parasitic inductance and capacitance in your circuit there are some high frequency oscilations caused by higher dv/dt on edges. I recommend to use some low pass filter which will eliminate high frequency components on 60Hz signal.

Or even change a bit principle of checking the falling edges using comparator module (CMP). One input of comparator will be connected to 60Hz (PTA13 doesn not have CMP in capability, it should be changed to different pin) and the second input of comparator will be connected to its internal 6-bit DAC which at the end can adjust the edge voltage reference level. Then configure the CMP interrupt on e.g. falling edge on CMP output (or rising edge, it will depends on what input will be positive and what negative).

regards

R.

0 Kudos

523 Views
dhananjayjoshi
Contributor I

Hi Rastislav,

Enabling the port filter helped filter-out the noise. Thanks a lot!

Regards,

DJay.

0 Kudos

523 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Dhananjay,

The phenomenon seems so weird, and I was wondering if you can upload the demo code and show the detailed procedure to replicate the issue.

I'm looking forward to your reply.
Have a great day,
Ping

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


Have a great day,
(my name)

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

0 Kudos

523 Views
dhananjayjoshi
Contributor I

Hi Jeremy,

Enabling the port filter helped.

Thanks,

Dhananjay.

0 Kudos