Self-executing interrupt problem

Hello! I’m using an interrupt with Beaglebone Black as indicated below, however I’m having problem.
PROBLEM: The interrupt that goes through the callback function “toggleState” is triggering itself, without any external reason or action.

Has anyone seen this happen and knows how to solve it?


myInput = ‘P9_11’;

b.pinMode(myInput, b.INPUT);
b.attachInterrupt(myInput, true, b.CHANGE, toggleState);

function toggleState(x) { <<==== Running for no reason
console.log(‘Interruption triggered’);

In toggleState, use console.log(JSON.stringify(x)); to see why the interrupt triggered.


John, in the correct execution of the interrupt, that is, when I press a button so that the interrupt is actually executed, the answer is this below. I’m still waiting to know if self-interrupt will run again and then see what new response from “console.log (JSON.stringify (x))”.

Response to the correct interrupt:

“pin”: {
“output”: {“handler”:true}

What should I observe in this response when the error occurs again?

Hello again John. I was able to observe the error occurring and the interruption being executed without reason. But the response from “console.log (JSON.stringify (x));” was still the same when the interrupt was executed correctly, ie when I pressed the button.

So, if you have any suggestions, I appreciate any help.

Do you have a resistor pull up or pull down on this pin? If your button pulls the GPIO pin low, then you need a resistor pull up of at least 10K. It seems like you don’t have this resistor connected and hence noise is triggering the interrupt.


I think you’re right John. I don’t have a pulldown resistor. I forgot it… I’ll try again now and let you know the answer when I’m done. Thanks!!

I’m still testing, but I think the problem was even the lack of resistors.
Thank you again!