enter image description here

Above is the picture describing the configuration outside the MCU.

Vin is 0 to 5V Peak to Peak square wave which may have 0 to 50 KHz frequency, or even higher.

The MCU is supposed to handle interrupt every falling OR rising edge(configure as either one of them, but not both) of the /INT port.

In order to not jam the MCU with interrupts in case of very high frequency VIN, I added a simple low frequency filter in front of MCU port.

The problem is that I am seeing false trigger of interrupt, If i set up as rising edge trigger. Everything works fine if i set up interrupt as falling edge.

How I know that Interrupt is false triggering is that I am measuring the time between each interrupts, as I am feeding the certainly known signal(from calibrator, observed with oscilloscope).

The problem goes away if I remove the 10nF capacitor.

However, in my application, I have used up all the timers, so I cannot use timers to limit the interrupt frequency, which forces me to limit it outside of the MCU

The cpu is PIC32 series.

Is there any ways I can achieve purpose of preventing external interrupt from firing too frequently?

  • 1
    \$\begingroup\$ You want to check whether the PIC32 µC supports input pins with Schmitt trigger. \$\endgroup\$
    – Turbo J
    Commented Jan 29, 2016 at 9:36
  • \$\begingroup\$ check with an oscilloscope how your switching edges look like on the pin. If they are not smooth, you may have to adjust your filter. In software my suggestion would have been using an timeout, but as you said you have no spare timers this may not be an option. \$\endgroup\$
    – jwsc
    Commented Jan 29, 2016 at 9:47
  • \$\begingroup\$ Is the INT port 5V tolerant? \$\endgroup\$
    – Steve G
    Commented Jan 29, 2016 at 9:58
  • \$\begingroup\$ Where does Vin come from? Is it a clean signal or noisy? \$\endgroup\$
    – Steve G
    Commented Jan 29, 2016 at 10:00
  • \$\begingroup\$ @SteveG The port is 5V tolerant. Vin is not exactly square wave, but somewhere between square wave and triangular wave,. However, the signal is not noisy. When it crosses the filter, it gets distorted due to filter's time constant \$\endgroup\$
    – Steve
    Commented Jan 30, 2016 at 0:32

1 Answer 1


Your input setup has a time constant of 10 microseconds, a huge amount of time when looking at MCU ports.

When the input transitions, it will spend significant time in the input indeterminate region - the range of voltages between Vil(max) and Vih(min). This will result in the input pin sensing something and quite possibly changing states multiple times for a single input transition on the output of the input buffer, thereby resulting in multiple 'phantom' interrupts.

In addition, this appears to be a CMOS input, and slow rise / fall times risk damaging the input buffer structure.

This application note from TI explains the issue.

Removing the capacitor allows the signal to move through the indeterminate region cleanly, minimising the possibility of metastability as these pins are asynchronous inputs.

I see the port pins have a Schmitt trigger available, but the 'peripheral input' buffer does not. If you can select the Schmitt trigger input, then the capacitor should have no effect (other than reducing the number of interrupts you may have per unit time).

The datasheet I have shows a mixture of trigger and 'ordinary' input pins, but the list will vary by device, so check your specific pin tables.

  • \$\begingroup\$ The part i am using is PIC32MX450 series, and it has Schmitt trigger buffer for External interrupt and input port. So, does that make it somewhat immune to the metastability you mentioned? \$\endgroup\$
    – Steve
    Commented Jan 30, 2016 at 0:44
  • \$\begingroup\$ Even triggers can be metastable depending on the specifics of the port. Your experience shows that perhaps this particular implementation is not immune to long time constants. Try a 10pF capacitor, as this will likely work in your situation. \$\endgroup\$ Commented Jan 30, 2016 at 19:15

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.