Interrupts issue

chegewara
Posts: 2228
Joined: Wed Jun 14, 2017 9:00 pm

Interrupts issue

Postby chegewara » Mon Jun 26, 2017 3:38 am

Im assuming its natural behaviour rather than bug, but i want to be sure. After few strange crashes of my program i tested it with gpio example and still crashing. I changed a little bit gpio example program to suit my needs:
- input pins aren't connected to output pins, but thru buttons with GND
- line 77 changed to

Code: Select all

io_conf.intr_type = GPIO_PIN_INTR_LOLEVEL;
Now, long press button is crashing program.

Code: Select all

GPIO[13] intr, val: 0
GPIO[13] intr, val: 0
GPIO[13] intr, val: 0
GPIO[Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0)
Register dump:
PC      : 0x40082cc6  PS      : 0x00060034  A0      : 0x400816e5  A1      : 0x3ffb05e0
A2      : 0x0000001f  A3      : 0x00002000  A4      : 0x00000000  A5      : 0x00000007
A6      : 0x00000000  A7      : 0x00060c20  A8      : 0x0000001f  A9      : 0x3ff44000
A10     : 0x0000000d  A11     : 0x00060b20  A12     : 0x800d07a2  A13     : 0x3ffafd60
A14     : 0x3ffafe4c  A15     : 0x3ffaffc8  SAR     : 0x00000013  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x40082cc6:0x3ffb05e0 0x400816e2:0x3ffb0600
Maybe its just my fault and i should use GPIO_PIN_INTR_NEGEDGE rather than GPIO_PIN_INTR_LOLEVEL for buttons interruption?
Last edited by chegewara on Mon Jun 26, 2017 10:39 pm, edited 1 time in total.

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

Re: Interruptions issue

Postby ESP_Sprite » Mon Jun 26, 2017 8:12 am

Yes. With a low _level_ interrupt, the interrupt will keep on triggering over and over again while the button is pressed, causing the CPU to execute nothing else anymore and the WDT rightfully kicking in. Neg edge probably does what you want here.

chegewara
Posts: 2228
Joined: Wed Jun 14, 2017 9:00 pm

Re: Interrupts issue

Postby chegewara » Mon Jun 26, 2017 10:54 pm

When i install isr with gpio_install_isr_service(FLAG), with flag ESP_INTR_FLAG_EDGE program is crashing with code 261 (0x105). Even combined with flag level1 crash with error 261.

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

Re: Interrupts issue

Postby ESP_Sprite » Tue Jun 27, 2017 2:21 am

What do you mean, 'crash with code 261'? Do you get a guru meditation error? Can you post your specific code here?

chegewara
Posts: 2228
Joined: Wed Jun 14, 2017 9:00 pm

Re: Interrupts issue

Postby chegewara » Tue Jun 27, 2017 3:14 am

Code: Select all

esp_err_t err = gpio_install_isr_service(ESP_INTR_FLAG_EDGE | ESP_INTR_FLAG_LEVEL1);
	if(err) {
		printf(">> error_1 %i\n", (int) err);
		return;
	}
Output is

Code: Select all

 >> error_1 261
It was tested with example gpio code, with that modification.

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

Re: Interrupts issue

Postby WiFive » Tue Jun 27, 2017 3:36 am

ESP_ERR_NOT_FOUND No free interrupt found with the specified flags

chegewara
Posts: 2228
Joined: Wed Jun 14, 2017 9:00 pm

Re: Interrupts issue

Postby chegewara » Tue Jun 27, 2017 3:44 am

WiFive wrote:ESP_ERR_NOT_FOUND No free interrupt found with the specified flags


Its from example code, only interrupt which is instantiated, input pins have setup intr_type to POSEDGE. Is there something i am missing?

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

Re: Interrupts issue

Postby WiFive » Tue Jun 27, 2017 4:25 am

Example code uses

Code: Select all

gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
There are very few CPU edge type interrupts (even fewer with level 1) especially on CPU0

chegewara
Posts: 2228
Joined: Wed Jun 14, 2017 9:00 pm

Re: Interrupts issue

Postby chegewara » Tue Jun 27, 2017 4:36 am

I know how it looks like in example, since im not using any interrupts but 1 and its crashing with flag EDGE (with level1 or alone). Its confusing to me. Doeas that means that flag is beyond normal usage and in most cases i can use flag DEFAULT or level 1-3? As it states those are for C code.

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

Re: Interrupts issue

Postby WiFive » Tue Jun 27, 2017 5:04 am

Yes try without the edge flag.

Who is online

Users browsing this forum: GooseGoose and 86 guests