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?
EXAMPLE:
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.
Regards,
John
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”: {
“name”:“UART4_RXD”,
“gpio”:30,
“mux”:“gpmc_wait0”,
“eeprom”:18,
“key”:“P9_11”,
“muxRegOffset”:“0x070”,
“options”:[
“gpmc_wait0”,
“mii2_crs”,
“NA”,
“rmii2_crs_dv”,
“mmc1_sdcd”,
“NA”,
“NA”,
“gpio0_30”
]
},
“value”:0,
“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.
Regards,
John
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!