-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPIO interrupts don't work if gpio_install_isr_service
executes on APP cpu (IDFGH-5900)
#7594
Comments
gpio_install_isr_service
executes on APP cpugpio_install_isr_service
executes on APP cpu (IDFGH-5900)
I confirm that not all ports work on the second core. #include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define GPIO_INT_CORE 1
static void IRAM_ATTR gpio_handler(void* arg)
{
gpio_num_t pin_num = (gpio_num_t)(int)arg;
ets_printf("gpio_handler; core: %d, pin: %d\n", xPortGetCoreID(), pin_num);
}
void gpio_initialize(void * arg)
{
static int isr_initialized = 0;
gpio_num_t pin_num = (gpio_num_t)(int)arg;
gpio_config_t gpio_conf = {
.pin_bit_mask=(1ULL << pin_num),
.mode=GPIO_MODE_INPUT,
.pull_up_en=GPIO_PULLUP_ENABLE,
.pull_down_en=GPIO_PULLDOWN_DISABLE,
.intr_type=GPIO_INTR_ANYEDGE,
};
ESP_ERROR_CHECK(gpio_config(&gpio_conf));
if (!isr_initialized)
{
isr_initialized = 1;
ESP_ERROR_CHECK(gpio_install_isr_service(0)); // only once
}
ESP_ERROR_CHECK(gpio_set_intr_type(pin_num, GPIO_INTR_ANYEDGE));
ESP_ERROR_CHECK(gpio_isr_handler_add(pin_num, gpio_handler, (void*)pin_num));
ets_printf("gpio_initialize; core: %d, pin: %d\n", xPortGetCoreID(), pin_num);
for (;;)
vTaskDelay(1000);
}
void app_main()
{
vTaskDelay(100/portTICK_PERIOD_MS);
xTaskCreatePinnedToCore(gpio_initialize, "gpio_initialize_19", 2048, (void *)(int)GPIO_NUM_19, 1, NULL, GPIO_INT_CORE);
vTaskDelay(100/portTICK_PERIOD_MS);
xTaskCreatePinnedToCore(gpio_initialize, "gpio_initialize_34", 2048, (void *)(int)GPIO_NUM_34, 1, NULL, GPIO_INT_CORE);
for (;;)
vTaskDelay(1000);
} Core 0 - Works
Core 1 - Bug
Startup information:
|
Sorry for offtopic |
Please see my github profile. |
Got it (acpu/pcpu)! esp-idf/components/hal/esp32/include/hal/gpio_ll.h Lines 240 to 243 in 6a7d83a
Should be: *status = (core_id == 0) ? HAL_FORCE_READ_U32_REG_FIELD(hw->pcpu_int1, intr) : HAL_FORCE_READ_U32_REG_FIELD(hw->acpu_int1, intr); |
It was working in v4.3, this was broken by 874a720. |
I'm using ESP32-S3-DevKitC-1 v1.0 with the latest ESP-IDF (d0dd9ce) and by comparing the SOC Is this true? I can't find any documentation about this, and the |
@o-marshmallow |
Sorry for the delay, |
Environment
Problem Description
Title. Peripheral raises the GPIOs but the interrupt doesn't fire or isn't serviced. On the other hand, if everything but
gpio_install_isr_service
executes on APP cpu, it all works fine.It's something related to running
gpio_isr_register_on_core_static
on the APP cpu.The text was updated successfully, but these errors were encountered: