Processing multiple interrupts sources

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Processing multiple interrupts sources

Postby dave111 » Thu Mar 16, 2017 10:13 pm

Hi, I'm looking at this code: http://www.lucadentella.it/en/2017/02/2 ... interrupts

What this code does: 1 interrupt source --> 1 ISR handler --> 1 semaphore --> 1 loop processing events delivered via xSemaphoreTake().

But I need to handle a multiple interrupts sources.

If I pass individual ID's as arg to gpio_isr_handler_add(), I can handle multiple interrupt sources and I still only need 1 ISR handler. This is great! But how am I supposed to forward the individual ID's through the semaphore mechanism? Do I need to use a list of semaphores, 1 per event source? Oh no. And then I also need to code and run a dedicated loop for each semaphore?? That can't be right. Hopefully someone can point me in a better direction. Thank you.

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

Re: Processing multiple interrupts sources

Postby WiFive » Fri Mar 17, 2017 1:16 am

Task notification, event group, queue, ... Depends on how much info you need to send to the task

http://www.freertos.org/RTOS_Task_Notif ... Group.html

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: Processing multiple interrupts sources

Postby dave111 » Fri Mar 17, 2017 11:07 am

Thank you. This makes a lot of sense.

Unfortunately after switching from xSemaphoreGiveFromISR() to xTaskNotifyFromISR() I now get this:
Untested FreeRTOS function xTaskNotifyFromISR
/home/dave/code/esp32/esp-idf/components/freertos/./tasks.c:4780 (xTaskNotifyFromISR)- assert failed!
abort() was called at PC 0x4008503a
Guru Meditation Error: Core 0 panic'ed (abort)
I then rolled back the changes to my task method (went back from xTaskNotifyWait() to xSemaphoreTake()) but Guru Meditation still occurs. So my task method is not being triggered by xTaskNotifyFromISR(). It just sits there doing nothing. It should definitely not be involved.

Only if I out-remark the call to xTaskNotifyFromISR() from my ISR, do I get rid of the Guru Meditation. Is there some working xTaskNotifyFromISR() sample code for ESP32 anywhere to look at / try out?

Also: portYIELD_FROM_ISR(xHigherPriorityTaskWoken) does not seem to be supported. However portYIELD_FROM_ISR() appears to be. So I don't need to use xHigherPriorityTaskWoken, right? Thx.

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

Re: Processing multiple interrupts sources

Postby WiFive » Fri Mar 17, 2017 7:26 pm

Oops didn't realize this was on the untested blacklist. You can disable the abort in menuconfig if you want to try it.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: Processing multiple interrupts sources

Postby dave111 » Fri Mar 17, 2017 8:12 pm

It doesn't say "Untested FreeRTOS... abort() was called" any more. But it still says "Guru Meditation" as soon as xTaskNotifyFromISR() has been called. Only now with a slightly different remark:
Error: Core 0 panic'ed (Interrupt wdt timeout on CPU1)
"wdt" = Watch Dog Timer, correct? I've tried several values, including portMAX_DELAY. No change.

What else can I try? I only need to send 8 (or 16) bits from ISR to task.

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

Re: Processing multiple interrupts sources

Postby WiFive » Fri Mar 17, 2017 8:42 pm


dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: Processing multiple interrupts sources

Postby dave111 » Sat Mar 18, 2017 12:39 am

Event Groups are working well. Thank you so much.

Who is online

Users browsing this forum: No registered users and 295 guests