Interrupting both cores on esp32 s3

Slinisa
Posts: 14
Joined: Sat Oct 07, 2023 8:21 am

Interrupting both cores on esp32 s3

Postby Slinisa » Tue Feb 13, 2024 12:07 am

I wrote a program that interrupts a core on DMA transfer complete and it works fine and I want to involve (so far) idle core.
Is it possible to interrupt both cores with the same event (like DMA transfer complete)? If so, how?
If not, what is the best way to interrupt one core from the other (and exchange data)?

Slinisa
Posts: 14
Joined: Sat Oct 07, 2023 8:21 am

Re: Interrupting both cores on esp32 s3

Postby Slinisa » Tue Feb 13, 2024 4:00 pm

After some research I found xQueueSendFromISR and xQueueReceive which work, but the response of a second core is really slow. I send a message from within ISR on the first core and I have a code below started on a second core, I also set a pin high from within ISR and clear it on the second core after the message is received. The pulse width is around 10 us, which is terrible. I need the response to be below 1 us, order of magnitude slower. Any advices?

void secondCore(void *unused) {
int data;
for (;;){
delay(0);
xQueueReceive(queue, &data, portMAX_DELAY);
GPIO.out_w1tc = 1 << 11;
}
}

lbernstone
Posts: 599
Joined: Mon Jul 22, 2019 3:20 pm

Re: Interrupting both cores on esp32 s3

Postby lbernstone » Tue Feb 13, 2024 5:57 pm

I can't guarantee that it will be any faster, since it is depending on FreeRTOS, but you could have a suspended task that you notify from the ISR.

MicroController
Posts: 1042
Joined: Mon Oct 17, 2022 7:38 pm

Re: Interrupting both cores on esp32 s3

Postby MicroController » Tue Feb 13, 2024 6:01 pm

and I want to involve (so far) idle core.
Don't pin your task to a core. When an unpinned task becomes runnable, it will be scheduled to whichever core is available at that moment.
The pulse width is around 10 us, which is terrible. I need the response to be below 1 us, order of magnitude slower. Any advices?
That's not going to happen. 10-15us is the normal time it takes to switch contexts, e.g. from ISR to a task's context; there's nothing you could do about that. You can do some things inside the ISR itself, which saves the 10us for the context switch, but even an ISR can have delay/jitter in the order of a microsecond or more.

Slinisa
Posts: 14
Joined: Sat Oct 07, 2023 8:21 am

Re: Interrupting both cores on esp32 s3

Postby Slinisa » Wed Feb 14, 2024 12:28 am

I managed to get 200 ns. I was cheating a bit, but I'm not getting guru meditation, so I consider it a win.

Who is online

Users browsing this forum: No registered users and 24 guests