Greetings! I'm using the ESP32 dual core with the Arduino IDE. I'm passing data between the two cores using a queue.
--> Is there a way for one core to generate an internal interrupt to the other core, so that the interrupted core knows that "it's time to read the queue"?
Setup:
Right now, I have CORE0 using GPIO 34 as an output, and CORE1 using GPIO 23 as an input (with an attached interrupt). Pins 34 and 23 are tied together by an external wire.
--> CORE0 writes to the queue, and then it raises GPIO 34 high
--> CORE1 gets the interrupt on GPIO 23, and then reads the queue in the ISR
The above setup works, but it uses two GPIO pins. I'm wondering if there is a better way to do this.
ESP32 dual core - is there an internal interrupt from one core to the other?
-
- Posts: 1
- Joined: Tue Aug 23, 2022 4:15 pm
-
- Posts: 9729
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32 dual core - is there an internal interrupt from one core to the other?
Yes, there is, and it's heavily used internally by the multicore features of the FreeRTOS RTOS. Effectively, if you try to read from an empty queue on core 1, the RTOS will simply stop executing the task. Then, if core 0 pushes something into the queue, it'll use the internal interrupt to tell core 1 that the queue has something in it. FreeRTOS on core 1 will then schedule the task again, and the read will succeed.
In other words, the proper way would be to (instead of an ISR) start a task that simply reads from the queue and processes whatever it can read. The task will only run when needed, so it's CPU-efficient.
In other words, the proper way would be to (instead of an ISR) start a task that simply reads from the queue and processes whatever it can read. The task will only run when needed, so it's CPU-efficient.
Who is online
Users browsing this forum: Google [Bot] and 72 guests