Interrupt on GPIO23 not working

Acuario
Posts: 7
Joined: Mon Apr 04, 2016 11:21 am

Interrupt on GPIO23 not working

Postby Acuario » Wed Nov 20, 2024 5:25 pm

Hi,

I have set up an interrupt on GPIO23 on an ESP32-WROOM-32E but it does not get triggered.
I have changed to GPIO19 with exactly the same code and it works so I know my code is ok.
I have attached a scope to GPIO23 and I see the IO being toggled by the device that generates the interrupt so that´s ok as well.

So I have no idea.. it seems it is not a hardware or software problem so any ideas? Is there a problem with this GPIO?

I´m using the latest version of the ESP32 code for Arduino.

GPIO23 is pin 37 on the ESP32.

Code: Select all

void IRAM_ATTR gyroValid() {
    Serial.print("GyroInt");
    if(!gyroData)
        gyroData = true;
}

#define INT_GYRO 23
    pinMode(INT_GYRO, INPUT_PULLUP);
    attachInterrupt(INT_GYRO, gyroValid, FALLING);  //Configures interrupt


Acuario
Posts: 7
Joined: Mon Apr 04, 2016 11:21 am

Re: Interrupt on GPIO23 not working

Postby Acuario » Wed Nov 20, 2024 6:10 pm

So this is weird..
after doing some testing it seems the use of #define for the GPIO pin is causing the problem.

Changing it to:
constexpr int INT_GYRO = 23;

and the interrupt works as expected.

It seems it is a compiler related problem?
This is strange as I have other programs with interrupts where the GPIO is defined with #define and they work correctly.

Who is online

Users browsing this forum: No registered users and 44 guests