Troubles with GIGA R1, input_pullup, attach

Sure, here's the translation:

When I initialize a pin as input_pullup, everything works as expected. When I measure the line, I get 3.3V, and I can pull it to GND, and reading it works perfectly.
However, when I set an attachinterrupt on this pin, it no longer works. The voltage stays at around 0V. The pin then behaves unpredictably. Sometimes the change to 0 is detected, sometimes it’s not.

Both methods of the attachment with the same result. I'm sure it worked fine before the update of the board in the IDE.

I know that I can use en external resistor and this will be my workaround. But - what is wrong?

const int inpPin1 = 48;          // Input 1 on/off
const int inpPin2 = 38;          // Input 2 on/off
boolean i1=false, i2=false, isr1=false, isr2=false;

void setup() {
  Serial.begin(115200);
  pinMode(inpPin1, INPUT_PULLUP);
  pinMode(inpPin2, INPUT_PULLUP);

//  attachInterrupt(digitalPinToInterrupt(inpPin1), toggle_inp1_ISR, CHANGE);
//  attachInterrupt(digitalPinToInterrupt(inpPin2), toggle_inp2_ISR, CHANGE);
  attachInterrupt(inpPin1, toggle_inp1_ISR, CHANGE);
  attachInterrupt(inpPin2, toggle_inp2_ISR, CHANGE);

}

void loop() {
  i1=digitalRead(inpPin1);
  i2=digitalRead(inpPin2);
  Serial.print(i1); Serial.print(" "); Serial.println(i2);
  delay(500);
}


// ************************ toggle_inp1_ISR ************************
void toggle_inp1_ISR() {

  isr1=true;

}

// ************************ toggle_inp2_ISR ************************
void toggle_inp2_ISR() {

isr2=true;

}


Hi @gerhard_r . This relates to your problem.

Workaround is to set mode after attaching

Thank you!!!!
It's working :slight_smile:

Thanks.

You read code examples that are supposed to help you, you type them, you run them, it doesn't work.

Why so much hate ?:weary_face:

I thought I had a bad contact in the wires because as soon as I touched the wire of the digital input the LED lights up and as soon as I let it go, everything went out. 0V to the voltmeter in the wire !?! That said, it makes a great free capacitive switch because you just have to touch the wire at the plastic and the LED lights up (if you make it light up in the interruption ISR which unfortunately does not stop triggering as long as you touch the plastic).

2 days spent on it.

Out of masochism I'm going to try arming the same interrupt on the M4. :anxious_face_with_sweat:

Edit : on M4 works fine as on M7.