Interrupt on GPIO36 triggered only once

jubueche
Posts: 32
Joined: Sat Jan 19, 2019 4:03 pm

Interrupt on GPIO36 triggered only once

Postby jubueche » 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:

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Interrupt on GPIO36 triggered only once

Postby WiFive » Tue Sep 03, 2019 12:00 am

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

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Interrupt on GPIO36 triggered only once

Postby rudi ;-) » Tue Sep 03, 2019 1:29 am

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
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

jubueche
Posts: 32
Joined: Sat Jan 19, 2019 4:03 pm

Re: Interrupt on GPIO36 triggered only once

Postby jubueche » Tue Sep 03, 2019 8:12 am

Oh okay thanks.

Who is online

Users browsing this forum: esp32New956832 and 95 guests