I am trying to raise a GPIO Interrupt Service Routine on Core 1, but it doesn't working... I just tried like this:
1.) Creating a Task which is pinned to Core 1
2.) executing gpio_install_isr_service(0); and gpio_isr_handler_add(...) in the task pinned to core 1
In the doc's I have just read that the GPIO ISR is executing on that core where the ISR was registered ?!
To verify on which the current code is running I am using xPortGetCoreID()
When I launch my code, then Task is running on Core 1, but the ISR is running on Core 0.... so it does not working...
So what I am doing wrong ?
Below is my "minimal example code":
Code: Select all
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define GPIO_INT_PIN GPIO_NUM_35
#define ESP_INTR_FLAG_DEFAULT 0
static void IRAM_ATTR GPIO_INT_HANDLER(void* arg){
ets_printf("Core ID of DRDY ISR: %d\n",xPortGetCoreID());
}
void TASK_config_DRDY_INT_HANDLER(void * pvParameters){
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
gpio_set_intr_type(GPIO_INT_PIN, GPIO_INTR_NEGEDGE);
gpio_isr_handler_add(GPIO_INT_PIN, GPIO_INT_HANDLER, NULL);
ets_printf("Core ID of DRDY_ISR_CONFIG TASK: %d\n",xPortGetCoreID());
while(1){
vTaskDelay(1);
}
}
void app_main(){
gpio_config_t GPIO_INT_PIN_CONFIG={
.intr_type=GPIO_INTR_NEGEDGE,
.pin_bit_mask=(1ULL<< GPIO_INT_PIN),
.mode=GPIO_MODE_INPUT,
.pull_up_en=GPIO_PULLUP_DISABLE,
.pull_down_en=GPIO_PULLDOWN_DISABLE,
};
ESP_ERROR_CHECK(gpio_config(& GPIO_INT_PIN_CONFIG));
vTaskDelay(1000/portTICK_PERIOD_MS);
xTaskCreatePinnedToCore(TASK_config_DRDY_INT_HANDLER,
"TASK_config_DRDY_INT_HANDLER",
2048, NULL, 1, NULL, 1);
while(1){
vTaskDelay(1);
}
}
opcode_x64