ESP32 panics when using interrupt

orbitcoms
Posts: 141
Joined: Fri Aug 03, 2018 10:08 pm
Location: Sydney, Australia

ESP32 panics when using interrupt

Postby orbitcoms » Mon Oct 18, 2021 5:15 am

I have a project that is using one interrupt but when the gpio activates the interrupt, the ESP32 keeps panicking and resetting.
If I comment out the interrupt setup and handler it works fine. Not sure what I have done wrong here. Using VScode with ESP-IDF 4.3, ESP-IDF extension v1.2.0. Device is WROOM 32

The interrupt and the semaphore it sets are in 1 module and the function that takes the semaphore in another. The interrupt signal is on the pin for 103ms and then off for 64ms till next interrupt. The interrupt is set up to trigger on positive going edge of the gpio.

First Module that sets up the interrupt and GPIO

[code]
xSemaphoreHandle got_wake;

static void IRAM_ATTR wake_interrupt(void* args)
{
xSemaphoreGiveFromISR(got_wake,false);
}

void io_init(void)
{
gpio_pad_select_gpio(WAKE);
gpio_set_direction(WAKE,GPIO_MODE_INPUT);
gpio_pullup_dis(WAKE);
gpio_pulldown_en(WAKE);
gpio_set_intr_type(WAKE,GPIO_INTR_POSEDGE);
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT); //was 0
gpio_isr_handler_add(WAKE,wake_interrupt,(void*) WAKE);
got_wake = xSemaphoreCreateBinary();
}
[/code]

SECOND module that uses the semaphore set in the interrupt
[code]
extern xSemaphoreHandle got_wake;

void lf_process(void * params)
{
while(1)
{
xSemaphoreTake(got_wake,portMAX_DELAY);
printf("Got Wake\n");
}
}

void init_lf(void)
{
xTaskCreate(&lf_process,"do wake process",4096*2,NULL,1,NULL);
}
[/code]

Error at Runtime when WAKE gpio pin goes high

Who is online

Users browsing this forum: Bing [Bot], DrMickeyLauer, Google [Bot], sangk82 and 64 guests