Skip to content

Strange behaviour in HW interrupt firering on wrong edge #955

@henricazottes

Description

@henricazottes

Hardware:

Board: Wemos Lolin32-lite
Core Installation/update date: 29/jdec/2017
IDE name: Platform.io, Arduino framework
Flash Frequency: ?40Mhz?
Upload Speed: ?115200?

Description:

My interrupt fires multiple time on the wrong edge. It is configured to fire on a FALLING edge (which works fine) but then it also fires multiple times during the RISING edge.

Sketch:

//Change the code below by your sketch
#include <Arduino.h>
int CFG_PIN = 16;

void falling(){
  Serial.println("Falling: " + String(digitalRead(CFG_PIN)));
}

void setup() {
  pinMode(CFG_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(CFG_PIN), falling, FALLING);
  Serial.begin(9600);
}

void loop() {
}

Output:

Falling: 0  <--- Triggered when pressing my button
// waiting some time with the button pressed, and then release the button
Falling: 0
Falling: 0
Falling: 1
Falling: 1
Falling: 1
Falling: 1

Why would I get all this agitation when releasing my button ? and moreover, why would I get the interruption when the state of the pin is HIGH ??

Note that I have a 100nF cap for the debounce, and my edges are clean on the oscilloscope. Is it bad doctor ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions