Error:GPIO isr service already installed

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Error:GPIO isr service already installed

Postby nirmeshru » Sun Sep 05, 2021 6:56 pm

Hi,

I modified the switch example and enabling two GPIO pins using two switch buttons.
I am using the ESP32 custom board and after loading the program getting the below error.

# switch button
#define BUTTON_GPIO_1 21
#define BUTTON_GPIO_2 17
#define BUTTON_ACTIVE_LEVEL 0

/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO_1 14
#define OUTPUT_GPIO_2 27


E (887) gpio: gpio_install_isr_service(438): GPIO isr service already installed
gpio_isr.PNG
gpio_isr.PNG (11.86 KiB) Viewed 73699 times
can you please help on this.

Thanks,
Nirmesh

codorstelian
Posts: 4
Joined: Thu Sep 02, 2021 8:02 am

Re: Error:GPIO isr service already installed

Postby codorstelian » Mon Sep 06, 2021 11:20 am

From what you posted I can only see that you have defined GPIO pins. Can you post the code where you configured GPIO?
You need to have something similar with:

Code: Select all

    button_handle_t btn_handle_1 = iot_button_create(BUTTON_GPIO_1, BUTTON_ACTIVE_LEVEL_1);
    button_handle_t btn_handle_2 = iot_button_create(BUTTON_GPIO_2, BUTTON_ACTIVE_LEVEL_2);
    if (btn_handle_1) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle_1, BUTTON_CB_TAP, push_btn_cb_1, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
        app_reset_button_register(btn_handle_1, WIFI_RESET_BUTTON_TIMEOUT, FACTORY_RESET_BUTTON_TIMEOUT);
    }
    if (btn_handle_2) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle_2, BUTTON_CB_TAP, push_btn_cb_2, NULL);
    }
    // Configure the GPIO
    gpio_config_t io_conf = {
        .mode = GPIO_MODE_OUTPUT,
        .pull_up_en = 1,
    };
    uint64_t pin_mask = (((uint64_t)1 << OUTPUT_GPIO_1) | ((uint64_t)1 << OUTPUT_GPIO_2));
    io_conf.pin_bit_mask = pin_mask;
    gpio_config(&io_conf);
I hope I managed to help you.

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Re: Error:GPIO isr service already installed

Postby nirmeshru » Mon Sep 06, 2021 2:49 pm

codorstelian wrote:
Mon Sep 06, 2021 11:20 am
From what you posted I can only see that you have defined GPIO pins. Can you post the code where you configured GPIO?
You need to have something similar with:

Code: Select all

    button_handle_t btn_handle_1 = iot_button_create(BUTTON_GPIO_1, BUTTON_ACTIVE_LEVEL_1);
    button_handle_t btn_handle_2 = iot_button_create(BUTTON_GPIO_2, BUTTON_ACTIVE_LEVEL_2);
    if (btn_handle_1) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle_1, BUTTON_CB_TAP, push_btn_cb_1, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
        app_reset_button_register(btn_handle_1, WIFI_RESET_BUTTON_TIMEOUT, FACTORY_RESET_BUTTON_TIMEOUT);
    }
    if (btn_handle_2) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle_2, BUTTON_CB_TAP, push_btn_cb_2, NULL);
    }
    // Configure the GPIO
    gpio_config_t io_conf = {
        .mode = GPIO_MODE_OUTPUT,
        .pull_up_en = 1,
    };
    uint64_t pin_mask = (((uint64_t)1 << OUTPUT_GPIO_1) | ((uint64_t)1 << OUTPUT_GPIO_2));
    io_conf.pin_bit_mask = pin_mask;
    gpio_config(&io_conf);
I hope I managed to help you.

@codorstelian Thanks for the help.
I have defined the gpio like as you suggested but still getting the same error.
E (906) gpio: gpio_install_isr_service(438): GPIO isr service already installed

I am using the below code.
https://github.com/nirmeshru/esp_switch ... p_driver.c

Thanks,
Nirmesh

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Error:GPIO isr service already installed

Postby ESP_Piyush » Mon Sep 06, 2021 3:20 pm

Hi Nirmesh,

If I remember correctly, that is more like a warning rather than an error. Do you face any actual issues while using the GPIO.

Regards,
Piyush

codorstelian
Posts: 4
Joined: Thu Sep 02, 2021 8:02 am

Re: Error:GPIO isr service already installed

Postby codorstelian » Mon Sep 06, 2021 4:15 pm

I have tried to reproduce the error and it appears when I add a second iot_button so I think this error is caused from the button library located in esp-rainmaker/components.

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Re: Error:GPIO isr service already installed

Postby nirmeshru » Mon Sep 06, 2021 6:02 pm

ESP_Piyush wrote:
Mon Sep 06, 2021 3:20 pm
Hi Nirmesh,

If I remember correctly, that is more like a warning rather than an error. Do you face any actual issues while using the GPIO.

Regards,
Piyush
Hi Piyush,

Actually when I tried two switches then there is no functional issue only getting the above error (warning).
but I am working for four switches so whenever I am trying with four switches getting below error and some watchdog task trigger and device start rebooting in a loop.

serial log -

I (867) gpio: GPIO[17]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
E (867) gpio: gpio_install_isr_service(438): GPIO isr service already installed
I (877) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
E (887) gpio: gpio_install_isr_service(438): GPIO isr service already installed
I (897) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
E (907) gpio: gpio_install_isr_service(438): GPIO isr service already installed

I (E (5777) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (5777) task_wdt: - IDLE0 (CPU 0)
E (5777) task_wdt: Tasks currently running:
E (5777) task_wdt: CPU 0: main
E (5777) task_wdt: CPU 1: ipc1
E (5777) task_wdt: Print CPU 0 (current core) backtrace


Thanks,
Nirmesh

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Error:GPIO isr service already installed

Postby ESP_Piyush » Tue Sep 07, 2021 6:11 pm

Hi Nirmesh,

Can you share the code snippet for this new issue?

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Re: Error:GPIO isr service already installed

Postby nirmeshru » Tue Sep 07, 2021 6:28 pm

ESP_Piyush wrote:
Tue Sep 07, 2021 6:11 pm
Hi Nirmesh,

Can you share the code snippet for this new issue?


Sure Piyush.
As similar to the 2 switch app_driver.c file, I modified app_driver.c for 4 switches.

Code: Select all

   
/* This is the button that is used for toggling the power */
#define BUTTON_GPIO_1		17
#define BUTTON_GPIO_2       18
#define BUTTON_GPIO_3       19
#define BUTTON_GPIO_4       21
#define BUTTON_ACTIVE_LEVEL  0

/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO_1		14
#define OUTPUT_GPIO_2   	25 
#define OUTPUT_GPIO_3   	26
#define OUTPUT_GPIO_4   	27
static bool g_power_state = DEFAULT_POWER;
static bool g_power_state3 = DEFAULT_POWER;
static bool g_power_state4 = DEFAULT_POWER;
static bool g_power_state_nirmesh = DEFAULT_POWER;

#define WIFI_RESET_BUTTON_TIMEOUT		3
#define FACTORY_RESET_BUTTON_TIMEOUT    10


static void push_btn_cb1(void *arg)
{
    bool new_state = !g_power_state;
    app_driver_set_state(new_state);
    esp_rmaker_param_update_and_report(
            esp_rmaker_device_get_param_by_name(switch_device1, ESP_RMAKER_DEF_POWER_NAME),
            esp_rmaker_bool(new_state));
}

static void push_btn_cb2(void *arg)
{
    bool new_state_nirmesh = !g_power_state_nirmesh;
    app_driver_set_state2(new_state_nirmesh);
    esp_rmaker_param_update_and_report(
            esp_rmaker_device_get_param_by_name(switch_device2, ESP_RMAKER_DEF_POWER_NAME),
            esp_rmaker_bool(new_state_nirmesh));
}

static void push_btn_cb3(void *arg)
{
    bool new_state3 = !g_power_state3;
    app_driver_set_state3(new_state3);
    esp_rmaker_param_update_and_report(
            esp_rmaker_device_get_param_by_name(switch_device3, ESP_RMAKER_DEF_POWER_NAME),
            esp_rmaker_bool(new_state3));
}

static void push_btn_cb4(void *arg)
{
    bool new_state4 = !g_power_state4;
    app_driver_set_state4(new_state4);
    esp_rmaker_param_update_and_report(
            esp_rmaker_device_get_param_by_name(switch_device4, ESP_RMAKER_DEF_POWER_NAME),
            esp_rmaker_bool(new_state4));
}

static void set_power_state(bool target)
{
    gpio_set_level(OUTPUT_GPIO_1, target);
    
}

static void set_power_state2(bool target)
{
    gpio_set_level(OUTPUT_GPIO_2, target);
    
}

static void set_power_state3(bool target)
{
    gpio_set_level(OUTPUT_GPIO_3, target);
    
}

static void set_power_state4(bool target)
{
    gpio_set_level(OUTPUT_GPIO_4, target);
    
}

void app_driver_init()
{
    button_handle_t btn_handle1 = iot_button_create(BUTTON_GPIO_1, BUTTON_ACTIVE_LEVEL);
	button_handle_t btn_handle2 = iot_button_create(BUTTON_GPIO_2, BUTTON_ACTIVE_LEVEL);
    button_handle_t btn_handle3 = iot_button_create(BUTTON_GPIO_3, BUTTON_ACTIVE_LEVEL);
	button_handle_t btn_handle4 = iot_button_create(BUTTON_GPIO_4, BUTTON_ACTIVE_LEVEL);
	
    if (btn_handle1) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle1, BUTTON_CB_TAP, push_btn_cb1, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
        app_reset_button_register(btn_handle1, WIFI_RESET_BUTTON_TIMEOUT, FACTORY_RESET_BUTTON_TIMEOUT);
	}
	if (btn_handle2) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle2, BUTTON_CB_TAP, push_btn_cb2, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
		
    }

	if (btn_handle3) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle3, BUTTON_CB_TAP, push_btn_cb3, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
		
    }

	if (btn_handle4) {
        /* Register a callback for a button tap (short press) event */
        iot_button_set_evt_cb(btn_handle4, BUTTON_CB_TAP, push_btn_cb4, NULL);
        /* Register Wi-Fi reset and factory reset functionality on same button */
		
    }

    /* Configure power */
    gpio_config_t io_conf = {
        .mode = GPIO_MODE_OUTPUT,
        .pull_up_en = 1,
    };
    io_conf.pin_bit_mask = (((uint64_t)1 << OUTPUT_GPIO_1) | ((uint64_t)1 << OUTPUT_GPIO_2) | ((uint64_t)1 << OUTPUT_GPIO_3) | ((uint64_t)1 << OUTPUT_GPIO_4));
    /* Configure the GPIO */
    gpio_config(&io_conf);
   
}

int IRAM_ATTR app_driver_set_state(bool state)
{
    
    g_power_state = state;
    set_power_state(g_power_state);
    
    return ESP_OK;
}

int IRAM_ATTR app_driver_set_state2(bool state)
{
    
    g_power_state_nirmesh = state;
    set_power_state2(g_power_state_nirmesh);
    
    return ESP_OK;
}

int IRAM_ATTR app_driver_set_state3(bool state)
{
    
    g_power_state3 = state;
    set_power_state3(g_power_state3);
    
    return ESP_OK;
}

int IRAM_ATTR app_driver_set_state4(bool state)
{
    
    g_power_state4 = state;
    set_power_state4(g_power_state4);
    
    return ESP_OK;
}

bool app_driver_get_state(void)
{
    return g_power_state;
}

bool app_driver_get_state2(void)
{
    return g_power_state_nirmesh;
}

bool app_driver_get_state3(void)
{
    return g_power_state3;
}

bool app_driver_get_state4(void)
{
    return g_power_state4;
}

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: Error:GPIO isr service already installed

Postby axellin » Tue Sep 07, 2021 11:41 pm

ESP_Piyush wrote:
Mon Sep 06, 2021 3:20 pm
Hi Nirmesh,

If I remember correctly, that is more like a warning rather than an error. Do you face any actual issues while using the GPIO.

Regards,
Piyush
"E (906)" indicates it's an error message.
If it is indeed harmless, please convert it to warning message (W).

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Error:GPIO isr service already installed

Postby ESP_Sprite » Wed Sep 08, 2021 7:49 am

"E (906)" indicates it's an error message.
If it is indeed harmless, please convert it to warning message (W).
Fyi, this is indeed an error, caused by a few of our components not working well together. The message you see is the only result of this error, as the GPIO API happens to catch it, but even if it is otherwise harmless, it is an error regardless and we will take measures to fix it.

(I'd like to also state that in general, it's not really our policy to generate error messages like that that you can 'just ignore', even if it happens to work out here.)

Who is online

Users browsing this forum: No registered users and 70 guests