Problem with interrupt callback being called all the time without button being pressed
Posted: Thu Oct 29, 2020 7:20 pm
Hello all,
I have a strange problem and hope that you have some ideas.
Hardware is a ESP32-PICO D4 in a M5Stack Atom Lite.
My first program to test interrupts in general works like a charm, it changes the color
of the LED when the button is pressed. There are not bounces, color skips or
what ever.
The second program is supposed to send a MQTT message when certain events occur.
This also works fine.
Now I wanted to combine the two and also trigger a MQTT message when the button is pressed.
But the result is completely messed up. For whatever reason, the callback function fires
all the time after reboot without the button ever being touched.
When I wanted to check if the first program, with the color LED, still works I got
the same behaviour there: right from the reboot the LED colors start to cycle
without the button being pressed.
So I erased and flashed the firmware again. Same behaviour. LED color cycle works at first, once
I upload and run the MQTT program the IRQ gets messed up and stays that way.
I found this viewtopic.php?t=8655#p48904
Any ideas what could cause this?
I have a strange problem and hope that you have some ideas.
Hardware is a ESP32-PICO D4 in a M5Stack Atom Lite.
My first program to test interrupts in general works like a charm, it changes the color
of the LED when the button is pressed. There are not bounces, color skips or
what ever.
The second program is supposed to send a MQTT message when certain events occur.
This also works fine.
Now I wanted to combine the two and also trigger a MQTT message when the button is pressed.
But the result is completely messed up. For whatever reason, the callback function fires
all the time after reboot without the button ever being touched.
When I wanted to check if the first program, with the color LED, still works I got
the same behaviour there: right from the reboot the LED colors start to cycle
without the button being pressed.
So I erased and flashed the firmware again. Same behaviour. LED color cycle works at first, once
I upload and run the MQTT program the IRQ gets messed up and stays that way.
I found this viewtopic.php?t=8655#p48904
but I don't think that's the issue in my case.Two possible reasons for that:
a) bouncing of the input signal, if that comes from a switch. There are lots of discussions in this forum about de-bouncing.
b) false triggers due to slow slope of the input signal. That happens with the ESP32. Either increase the slope of the signal, or use the de-bouncing method.
Any ideas what could cause this?