Page 1 of 1

Interrupt on GPIO36 triggered only once

Posted: Mon Sep 02, 2019 3:49 pm
by jubueche
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:

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);

Re: Interrupt on GPIO36 triggered only once

Posted: Tue Sep 03, 2019 12:00 am
by WiFive
Once an interrupt occurs, the INT pin is set to high and will remain high until it is reset by host. This can be done by setting RST_INT in SYS_TRIGGER register.
BNO055 datasheet

Re: Interrupt on GPIO36 triggered only once

Posted: Tue Sep 03, 2019 1:29 am
by rudi ;-)
jubueche wrote:
Mon Sep 02, 2019 3:49 pm

This is my code:

Code: Select all

...
........"BNO055-interrupt handler...
..

a) here
b) there
c) any

Re: Interrupt on GPIO36 triggered only once

Posted: Tue Sep 03, 2019 8:12 am
by jubueche
Oh okay thanks.