ArduinoCore-mbed icon indicating copy to clipboard operation
ArduinoCore-mbed copied to clipboard

attachInterrupt forces pin high

Open tikonen opened this issue 2 years ago • 0 comments

Hi, There appears to be a bug in attachInterrupt() call.

If pinMode is called on a pin before attachInterrupt is called with 'CHANGE' parameter the pin is forced high.

Minimal example. Tested with Arduino Nano 33 BLE and Mbed OS Nano board 4.0.8.

void dummy() {} // dummy interrupt handler

void setup() {
  pinMode(2, INPUT);
  attachInterrupt(2, dummy, CHANGE);
}

void loop()
{}

Steps to reproduce.

  1. Load the sketch above
  2. Measure voltage on pin 2. It's 3.3V. Expected result is that pin would be floating.

If call to pinMode is commented out, the pin works correctly and does not have a pull-up.

tikonen avatar Nov 10 '23 18:11 tikonen