GPIO INSTALL ISR SERVICE

kayleejacob1
Posts: 12
Joined: Mon Aug 17, 2020 1:39 pm

GPIO INSTALL ISR SERVICE

Postby kayleejacob1 » Thu Feb 10, 2022 11:36 pm

I have just switched over to clipse and new version of IDF 4.4 got esp32 s3

When i try to install isr service i am getting 266 error code
Digital::Digital() {
esp_err_t err=0;
ESP_LOGI(TAG, "start digi");
// TODO Auto-generated constructor stub
gpio_config_t io_conf = {};
//disable interrupt
io_conf.intr_type = GPIO_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_OUTPUT;
//bit mask of the pins that you want to set,e.g.GPIO18/19
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
//disable pull-down mode
io_conf.pull_down_en = (gpio_pulldown_t) 0;
//disable pull-up mode
io_conf.pull_up_en = (gpio_pullup_t)0;
//configure GPIO with the given settings
err= gpio_config(&io_conf);
if (err != ESP_OK){ ESP_LOGI(TAG,"error_: %s", esp_err_to_name(err));}

//interrupt of rising edge
io_conf.intr_type = GPIO_INTR_POSEDGE;
//bit mask of the pins, use GPIO4/5 here
io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
//set as input mode
io_conf.mode = GPIO_MODE_INPUT;
//enable pull-up mode
io_conf.pull_up_en = (gpio_pullup_t)0;
err=gpio_config(&io_conf);
if (err != ESP_OK){ ESP_LOGI(TAG,"error1 %s", esp_err_to_name(err));}

err=gpio_set_intr_type(ResetButton, GPIO_INTR_ANYEDGE);
if (err != ESP_OK){ ESP_LOGI(TAG,"error2 %s %d", esp_err_to_name(err),err);}

err= gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
if (err != ESP_OK){ ESP_LOGI(TAG,"error3 %s %d", esp_err_to_name(err),err);}

err= gpio_isr_handler_add(ResetButton, gpio_isr_handler, (void*)ResetButton);
if (err != ESP_OK){ ESP_LOGI(TAG,"error4 %s %d", esp_err_to_name(err),err);}

// err= gpio_set_level(LED, true);
if (err != ESP_OK){ ESP_LOGI(TAG,"error %s", esp_err_to_name(err));}
// configure_led();
ESP_LOGI(TAG, "digi setup done");

}

(911) digi: start digi
I (912) gpio: GPIO[48]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (919) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:1
I (928) digi: error3 ESP_ERR_NOT_FOUND 261
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x420a4363 PS : 0x00060733 A0 : 0x8201d5c0 A1 : 0x3fceb1d0
0x420a4363: esp_intr_get_cpu at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/esp_hw_support/intr_alloc.c:704

A2 : 0x00000000 A3 : 0x3fc999dc A4 : 0x3c0b3948 A5 : 0x3fceb200
A6 : 0x3fceb1e0 A7 : 0x0000000c A8 : 0x8201d31c A9 : 0x3fceb1a0
A10 : 0x60004000 A11 : 0x00000000 A12 : 0x00000001 A13 : 0x00060723
A14 : 0x3fceb180 A15 : 0x0000000c SAR : 0x00000020 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffffb


Backtrace:0x420a4360:0x3fceb1d00x4201d5bd:0x3fceb1f0 0x42008787:0x3fceb220 0x42008803:0x3fceb270 0x42008840:0x3fceb290 0x42003693:0x3fceb2b0 0x42003935:0x3fceb2d0 0x4037569d:0x3fceb310 0x403bb0ac:0x3fceb340 0x403bb515:0x3fceb380 0x403b62b1:0x3fceb4b0 0x40045c01:0x3fceb570 |<-CORRUPTED
0x420a4360: esp_intr_get_cpu at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/esp_hw_support/intr_alloc.c:703

0x4201d5bd: gpio_isr_handler_add at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/driver/gpio.c:473

0x42008787: Digital::Digital() at C:\Users\beent\eclipse-workspace-esp\HvacFirm\build/../components/Digital_System/Digital_System.cpp:66

0x42008803: __static_initialization_and_destruction_0(int, int) at C:\Users\beent\eclipse-workspace-esp\HvacFirm\build/../components/Digital_System/Digital_System.cpp:75

0x42008840: _GLOBAL__sub_I__ZN7DigitalC2Ev at C:\Users\beent\eclipse-workspace-esp\HvacFirm\build/../components/Digital_System/Digital_System.cpp:108

0x42003693: do_global_ctors at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/esp_system/startup.c:185 (discriminator 3)

0x42003935: start_cpu0_default at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/esp_system/startup.c:404 (discriminator 3)

0x4037569d: call_start_cpu0 at C:/Users/beent/OneDrive/Desktop/esp-idf-2/components/esp_system/port/cpu_start.c:632





ELF file SHA256: c9f59c23ae4bb7e7

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

Re: GPIO INSTALL ISR SERVICE

Postby ESP_Sprite » Fri Feb 11, 2022 3:30 am

From the API refs:
'ESP_ERR_NOT_FOUND No free interrupt found with the specified flags'

My guess would be that your global constructor runs before some interrupt allocator initialization. Global constructors are run in an indeterminable order; it's not good practice to assume other subsystems are already up and running when a global constructor is executed.

kayleejacob1
Posts: 12
Joined: Mon Aug 17, 2020 1:39 pm

Re: GPIO INSTALL ISR SERVICE

Postby kayleejacob1 » Fri Feb 11, 2022 10:11 pm

Your da Man thats what it was I will have to rember this

Who is online

Users browsing this forum: No registered users and 123 guests