Page 1 of 1

Interrupts issue

Posted: Mon Jun 26, 2017 3:38 am
by chegewara
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?

Re: Interruptions issue

Posted: Mon Jun 26, 2017 8:12 am
by ESP_Sprite
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.

Re: Interrupts issue

Posted: Mon Jun 26, 2017 10:54 pm
by chegewara
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.

Re: Interrupts issue

Posted: Tue Jun 27, 2017 2:21 am
by ESP_Sprite
What do you mean, 'crash with code 261'? Do you get a guru meditation error? Can you post your specific code here?

Re: Interrupts issue

Posted: Tue Jun 27, 2017 3:14 am
by chegewara

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.

Re: Interrupts issue

Posted: Tue Jun 27, 2017 3:36 am
by WiFive
ESP_ERR_NOT_FOUND No free interrupt found with the specified flags

Re: Interrupts issue

Posted: Tue Jun 27, 2017 3:44 am
by chegewara
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?

Re: Interrupts issue

Posted: Tue Jun 27, 2017 4:25 am
by WiFive
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

Re: Interrupts issue

Posted: Tue Jun 27, 2017 4:36 am
by chegewara
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.

Re: Interrupts issue

Posted: Tue Jun 27, 2017 5:04 am
by WiFive
Yes try without the edge flag.