Creating interrupt to a specific core

User avatar
Foxtrot813
Posts: 8
Joined: Sun Apr 08, 2018 6:37 am

Creating interrupt to a specific core

Postby Foxtrot813 » Sun Apr 29, 2018 3:49 am

Hi all,

I'm trying to discover if there is a way to pin an interrupt to a specific core, but I'm not finding much information about that. Say I have this timer interrupt configured:

Code: Select all

static void initTimerGroup0(int timer_idx, bool auto_reload, double timer_interval_sec)
{
	timer_config_t config;
	config.divider = TIMER_DIVIDER;
	config.counter_dir = TIMER_COUNT_UP;
	config.counter_en = TIMER_PAUSE;
	config.alarm_en = TIMER_ALARM_EN;
	config.intr_type = TIMER_INTR_LEVEL;
	config.auto_reload = auto_reload;
	timer_init(TIMER_GROUP_0, timer_idx, &config);

	timer_set_counter_value(TIMER_GROUP_0, timer_idx, 0x00000000ULL);

	timer_set_alarm_value(TIMER_GROUP_0, timer_idx, timer_interval_sec*TIMER_SCALE);
	timer_enable_intr(TIMER_GROUP_0, timer_idx);
	timer_isr_register(TIMER_GROUP_0, timer_idx, adcGetRaw, (void *)timer_idx, ESP_INTR_FLAG_IRAM, NULL);

	timer_start(TIMER_GROUP_0, timer_idx);
}
Is there a way to attach it to core 1 or core 0? If not, how may I know on which CPU this interrupt will execute?

chegewara
Posts: 1894
Joined: Wed Jun 14, 2017 9:00 pm

Re: Creating interrupt to a specific core

Postby chegewara » Sun Apr 29, 2018 12:35 pm

http://esp-idf.readthedocs.io/en/latest ... r_handle_t
http://esp-idf.readthedocs.io/en/latest ... _sharediib

The interrupt will always be allocated on the core that runs this function.
http://esp-idf.readthedocs.io/en/latest ... r_handle_t

And you can create task pinned to core.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Creating interrupt to a specific core

Postby fly135 » Sun Apr 29, 2018 4:55 pm

Just make sure the task that allocated the interrupt is pinned to the core that you want the interrupt to occur on.

John A

User avatar
Foxtrot813
Posts: 8
Joined: Sun Apr 08, 2018 6:37 am

Re: Creating interrupt to a specific core

Postby Foxtrot813 » Sun Apr 29, 2018 5:50 pm

Thanks guys, it worked. There's more interrupt manipulation than I thought, and from what I read, it's always advisable to create interrupt in a task pinned to a specific core....

Who is online

Users browsing this forum: Majestic-12 [Bot] and 42 guests