I do not know how to use higher intterupt, because when I use ESP_INTR_FLAG_LEVEL6 to create GPIO key intterupt. It will show error with: Guru Meditation Error : Core 0 panic'ed (Load access fault). Exception was unhandled.
Do I forget any thing? Please advise.
Please look my above code:
```c
#include <stdio.h>
#include "driver/gpio.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "led_strip.h"
#include "sdkconfig.h"
static const char *TAG = "example";
#define BLINK_GPIO CONFIG_BLINK_GPIO
static uint8_t s_led_state = 0;
static void blink_led(void) {
/* Set the GPIO level according to the state (LOW or HIGH)*/
gpio_set_level(BLINK_GPIO, s_led_state);
}
static void configure_led(void) {
ESP_LOGI(TAG, "Example configured to blink GPIO LED!");
gpio_reset_pin(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
}
void IRAM_ATTR func(void *arg) {
blink_led();
/* Toggle the LED state */
s_led_state = !s_led_state;
}
void app_main(void) {
/* Configure the peripheral according to the LED type */
configure_led();
/* Set the GPIO as a push/pull output */
gpio_reset_pin(0);
gpio_set_direction(0, GPIO_MODE_INPUT);
// gpio_set_direction(0, GPIO_MODE_DISABLE);
gpio_pullup_en(0);
gpio_set_intr_type(0, GPIO_INTR_NEGEDGE);
// In ESP32C3 will show : E (299) gpio: esp_intr_alloc failed (0x102)
// Guru Meditation Error : Core 0 panic'ed (Load access fault). Exception was unhandled.
gpio_install_isr_service(ESP_INTR_FLAG_LEVEL6);
// Replace the above code with the following code to compile normally
// gpio_install_isr_service(ESP_INTR_FLAG_LEVEL3);
gpio_isr_handler_add(0, func, NULL);
while (1) {
ESP_LOGI(TAG, "XXXXXXX");
vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
}
}
```
GPIO Intterrupt can not use ESP_INTR_FLAG_LEVEL6?
-
- Posts: 37
- Joined: Fri Dec 24, 2021 12:40 pm
Re: GPIO Intterrupt can not use ESP_INTR_FLAG_LEVEL6?
Hi,
Interrupts with a level above 3 can only be handled in assembly language,
https://github.com/espressif/esp-idf/bl ... lloc.h#L54
so for GPIO interrupts, the highest you can set them to is LEVEL3.
Interrupts with a level above 3 can only be handled in assembly language,
https://github.com/espressif/esp-idf/bl ... lloc.h#L54
so for GPIO interrupts, the highest you can set them to is LEVEL3.
Who is online
Users browsing this forum: No registered users and 143 guests