0

My code is as follows:

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"

#define GPIO_MPU_INTERRUPT GPIO_NUM_4
#define ESP_INTR_FLAG_DEFAULT 0

void app_main(void)
{
    gpio_config_t io_conf = {};
    io_conf.intr_type = GPIO_INTR_POSEDGE;
    io_conf.pin_bit_mask = 1ULL<<GPIO_MPU_INTERRUPT;
    io_conf.mode = GPIO_MODE_INPUT;
    io_conf.pull_up_en = GPIO_PULLUP_ENABLE;
    gpio_config(&io_conf);
    gpio_set_intr_type(GPIO_MPU_INTERRUPT, GPIO_INTR_ANYEDGE);
    gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
}

If I compile with optimization - it works fine. But when compiling without optimization - I am getting an error:

IDF/components/freertos/queue.c:821 (xQueueGenericSend)- assert failed!

assert failed: spinlock_acquire spinlock.h:122 (result == core_id || result == SPINLOCK_FREE)

...

0x4008b58f: spinlock_acquire at C:/Espressif/frameworks/esp-idf-v4.4.1/components/esp_hw_support/include/soc/spinlock.h:122
 (inlined by) xPortEnterCriticalTimeout at C:/Espressif/frameworks/esp-idf-v4.4.1/components/freertos/port/xtensa/port.c:288

0x400882a4: vPortEnterCritical at C:/Espressif/frameworks/esp-idf-v4.4.1/components/freertos/port/xtensa/include/freertos/portmacro.h:578
 (inlined by) xQueueGenericSend at C:/Espressif/frameworks/esp-idf-v4.4.1/components/freertos/queue.c:840
1
  • 2
    "If I compile with optimization"... the asserts are probably ifdefed out Commented Jul 30, 2022 at 11:10

1 Answer 1

1

Looks like it is a memory issue. I've changed IPC task stack size from 1024 to 1536 and it is working now

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.