GPIO input interruption is very sensitive

bxTennet71
Posts: 4
Joined: Thu Mar 26, 2020 10:45 pm

GPIO input interruption is very sensitive

Postby bxTennet71 » Fri Apr 24, 2020 12:46 pm

Hello

I have simple yet not working situation. Consider momentary button connected to ESP32. Negative edge interrupt enabled.

First case:
One leg of button to GND and one connected directly to ESP32
Software pull_up

Code: Select all

void add_button(uint8_t gpio_pin) {
  gpio_config_t io_conf;
  io_conf.intr_type = GPIO_PIN_INTR_NEGEDGE;
  io_conf.pin_bit_mask = GPIO_PIN_SEL_CALC(gpio_pin);
  io_conf.mode = GPIO_MODE_INPUT;
  io_conf.pull_up_en = 1;
  io_conf.pull_down_en = 0;
  gpio_config(&io_conf);

  gpio_isr_handler_add(gpio_pin, gpio_isr_handler, (void *)gpio_pin);
}
Second case, button pullup via 10kOhm resistor to VCC 3.3;

In both cases interruption is triggering randomly, without any reason (button is not pressed). Even when there is no button connected to the port interruption is still triggering.
I am using ESP32-devkit v1
ESP-IDF v4.2-dev-583-ga3816bcb7

Here is whole code:

https://github.com/bartoszwalicki/home- ... /buttons.c

bxTennet71
Posts: 4
Joined: Thu Mar 26, 2020 10:45 pm

Re: GPIO input interruption is very sensitive

Postby bxTennet71 » Fri Apr 24, 2020 3:04 pm

So it seems it was my hardware design flaw. I added 100nF capacitor between GPIO and GND and problem vanished!

lafar6502
Posts: 25
Joined: Fri Mar 27, 2020 8:26 pm

Re: GPIO input interruption is very sensitive

Postby lafar6502 » Fri Apr 24, 2020 8:38 pm

are you calling gpio_isr_handler_add in a loop? what is the reason for that?

Who is online

Users browsing this forum: Gaston1980 and 130 guests