Interrupts and cores: can I free one core of any interrupts?

markus_e
Posts: 2
Joined: Tue Nov 21, 2017 10:31 pm

Interrupts and cores: can I free one core of any interrupts?

Postby markus_e » Tue Nov 21, 2017 10:44 pm

I would like to know which of the two cores of the esp32 is used to run the background tasks like WIFI and Bluetooth.
Would it be possible, let's say core0 runs the background tasks, that I can use core1 and have it free of any interrupts?
I wrote a small test program which uses core1, just toggling one of the digital outputs, and observe that there is something which every 1 millisecond interrupts my program for about 7 microseconds.
Is there a separation of the management tasks (wifi, bt) to a certain core and can I somehow disable interrupts for the other core without side effects?

thanks for help!

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

Re: Interrupts and cores: can I free one core of any interrupts?

Postby ESP_Sprite » Wed Nov 22, 2017 10:21 am

By default, everything runs on core 0. Core 1 should not have any interrupts out-of-the-box except for two: the FreeRTOS tick interrupt and the interrupt that is used to synchronize D-port accesses (workaround for a hw issue). You can disable the tick interrupt on CPU 1 if you also disable the idle task watchdog and don't need non-pre-emptive scheduling on that core. The D-port int isn't really disable-able, but it normally shouldn't trigger that often (unless you're using hardware-acccelerated crypto).

Langelot
Posts: 12
Joined: Tue Jun 01, 2021 9:57 am

Re: Interrupts and cores: can I free one core of any interrupts?

Postby Langelot » Thu Sep 30, 2021 1:48 pm

Hello ESP_Sprite, What you said is interesting and exactly what I need, I have the same issue. How can you do that? I have tried vTaskSuspendAll() on core 1 but there is still a few miroseconds interruption each millisecond. I searched the internet but I can't find how to do disable the ticks and the idle task watchdog with arduino IDE.

Can you describe more precisely what you had in mind ? Some functions maybe?

Thank you.

Richard42
Posts: 1
Joined: Tue Feb 06, 2024 7:21 am

Re: Interrupts and cores: can I free one core of any interrupts?

Postby Richard42 » Tue Feb 06, 2024 7:23 am

I ran into the exact same problem, and I was able to dig through the source code and figure it out. Here is how to disable and re-enable the timer tick interrupt on the current core:

Code: Select all

#include "freertos/xtensa_timer.h"
#include "esp_intr_alloc.h"

        ESP_INTR_DISABLE(XT_TIMER_INTNUM);
        // super time critical stuff
        ESP_INTR_ENABLE(XT_TIMER_INTNUM);

Who is online

Users browsing this forum: No registered users and 32 guests