Interrupt on GPIO36 triggered only once
Posted: Mon Sep 02, 2019 3:49 pm
Hi,
I have attached an interrupt on the GPIO36 following the tutorial here: https://github.com/espressif/esp-idf/tr ... erals/gpio
I am using IDF 3.3, because I have dependencies on esp azure, which requires this version of the IDF.
When the interrupt is triggered, the level stays on High. When I reset the pin, the level is low again. If I however enable the interrupt again, the level becomes high automatically.
Do I need to manually set some flag in the callback?
This is my code:
I have attached an interrupt on the GPIO36 following the tutorial here: https://github.com/espressif/esp-idf/tr ... erals/gpio
I am using IDF 3.3, because I have dependencies on esp azure, which requires this version of the IDF.
When the interrupt is triggered, the level stays on High. When I reset the pin, the level is low again. If I however enable the interrupt again, the level becomes high automatically.
Do I need to manually set some flag in the callback?
This is my code:
Code: Select all
void IRAM_ATTR gpio_isr_handler(void* arg)
{
uint32_t gpio_num = (uint32_t) arg;
xQueueSendFromISR(config.gpio_evt_queue, &gpio_num, NULL);
}
void gpio_bno_task(void* arg)
{
uint32_t io_num;
for(;;) {
if(xQueueReceive(config.gpio_evt_queue, &io_num, portMAX_DELAY)) {
uint8_t level = gpio_get_level((gpio_num_t) io_num);
am_interrupt = true;
}
}
}
Code: Select all
gpio_config_t io_conf;
io_conf.intr_type = GPIO_INTR_POSEDGE;
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pin_bit_mask = GPIO_BNO_INT_MASK;
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
esp_err_t err = gpio_config(&io_conf);
if(err != ESP_OK) {
ESP_LOGE(TAG, "Error setting GPIO config.");
}
gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
//start gpio task
xTaskCreate(*handlerTask, "BNO055-interrupt handler", 2048, NULL, 10, NULL);
//install gpio isr service
gpio_install_isr_service(ESP_INTR_FLAG_EDGE);
//hook isr handler for specific gpio pin
gpio_isr_handler_add(GPIO_BNO_INT, *gpio_isr_handler, (void*) GPIO_BNO_INT);