espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.87k stars 7.32k forks source link

Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0). (IDFGH-13760) #14621

Open amoldeshpande opened 2 months ago

amoldeshpande commented 2 months ago

Answers checklist.

IDF version.

ESP-IDF-v5.3.0

Espressif SoC revision.

esp32-32S WROOM

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

ESP32 WROOM 32S

Power Supply used.

USB

What is the expected behavior?

should not crash

What is the actual behavior?

crashes with WDT error even with empty ISR

Steps to reproduce.

I am trying to get a CC1101 chip working with an ESP32. Using ESP-IDF plugin for VsCode.

gpio setup:

bool          bRet    = true;
        gpio_config_t gpioConfig;

        gpioConfig.intr_type    = GPIO_INTR_LOW_LEVEL;
        gpioConfig.pin_bit_mask = 1 << m_deviceConfig.RxPin;
        gpioConfig.mode         = GPIO_MODE_INPUT;
        gpioConfig.pull_up_en   = GPIO_PULLUP_DISABLE;
        gpioConfig.pull_down_en = GPIO_PULLDOWN_DISABLE;

        ESP_LOGD(TAG, "%s gpioconfig pin mask is 0x%0X", __FUNCTION__, (int)gpioConfig.pin_bit_mask);
        CERA(gpio_config(&gpioConfig));

        CERA(gpio_install_isr_service(0));

        CERA(gpio_isr_handler_add(m_deviceConfig.RxPin, gpioISR, this));

ISR:


void IRAM_ATTR CC1101Device::gpioISR(void *thisPtr)
    {
        /*CC1101Device *That   = static_cast<CC1101Device *>(thisPtr);
        uint32_t      ignore = 0;
        xQueueSendFromISR(That->m_ISRQueueHandle, (void *)&ignore, NULL);
        */
    }

Please note that every single line in the ISR is commented out.

Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0).

Core  0 register dump:
PC      : 0x400833fe  PS      : 0x00060034  A0      : 0x400830e0  A1      : 0x3ffb1110
0x400833fe: gpio_intr_service at J:/esp/v5.3/esp-idf/components/esp_driver_gpio/src/gpio.c:495
0x400830e0: _xt_lowint1 at J:/esp/v5.3/esp-idf/components/xtensa/xtensa_vectors.S:1240

A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x40087812  
0x40087812: _frxt_int_enter at J:/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:140

A6      : 0x00000000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ff44000  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x800e09fe  A13     : 0x00000000
A14     : 0x0000000e  A15     : 0x0000000e  SAR     : 0x00000012  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000
Core  0 was running in ISR context:
EPC1    : 0x400d35b7  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400833fe
0x400d35b7: uart_hal_write_txfifo at J:/esp/v5.3/esp-idf/components/hal/uart_hal_iram.c:27
0x400833fe: gpio_intr_service at J:/esp/v5.3/esp-idf/components/esp_driver_gpio/src/gpio.c:495

Backtrace: 0x400833fb:0x3ffb1110 0x400830dd:0x3ffb1140 0x400d342a:0x3ffb5a20 0x400881e1:0x3ffb5a40 0x400873e9:0x3ffb5a60
0x400833fb: gpio_ll_get_intr_status_high at J:/esp/v5.3/esp-idf/components/hal/esp32/include/hal/gpio_ll.h:282 (discriminator 2)
 (inlined by) gpio_intr_service at J:/esp/v5.3/esp-idf/components/esp_driver_gpio/src/gpio.c:493 (discriminator 2)
0x400830dd: _xt_lowint1 at J:/esp/v5.3/esp-idf/components/xtensa/xtensa_vectors.S:1240
0x400d342a: esp_vApplicationIdleHook at J:/esp/v5.3/esp-idf/components/esp_system/freertos_hooks.c:45
0x400881e1: prvIdleTask at J:/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4344 (discriminator 1)
0x400873e9: vPortTaskWrapper at J:/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

Core  1 register dump:
PC      : 0x4008570e  PS      : 0x00060734  A0      : 0x800d344e  A1      : 0x3ffb6000
0x4008570e: esp_cpu_wait_for_intr at J:/esp/v5.3/esp-idf/components/esp_hw_support/cpu.c:64

A2      : 0x00000000  A3      : 0x00000000  A4      : 0x3ffaf910  A5      : 0x3ffaf8f0
A6      : 0x40081da8  A7      : 0x00000001  A8      : 0x800e09fe  A9      : 0x3ffb5fc0
0x40081da8: ipc_task at J:/esp/v5.3/esp-idf/components/esp_system/esp_ipc.c:53

A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffaf8f0  A13     : 0x3ffaf8d0
A14     : 0x00000001  A15     : 0x3ffafda8  SAR     : 0x00000000  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x4008570b:0x3ffb6000 0x400d344b:0x3ffb6020 0x400881e1:0x3ffb6040 0x400873e9:0x3ffb6060
0x4008570b: xt_utils_wait_for_intr at J:/esp/v5.3/esp-idf/components/xtensa/include/xt_utils.h:82
 (inlined by) esp_cpu_wait_for_intr at J:/esp/v5.3/esp-idf/components/esp_hw_support/cpu.c:55
0x400d344b: esp_vApplicationIdleHook at J:/esp/v5.3/esp-idf/components/esp_system/freertos_hooks.c:58
0x400881e1: prvIdleTask at J:/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4344 (discriminator 1)
0x400873e9: vPortTaskWrapper at J:/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

ELF file SHA256: 5071a0034

Rebooting...
ets Jul 29 2019 12:21:46

The problem I was actually trying to solve is that I am not able to get any interrupts at all, even though I'm fairly certain the CC1101 is set up correctly.

In playing with various interrupt types, I finally tried LOW_LEVEL and hit this crash every time I run the code.

Any ideas ?

Debug Logs.

No response

More Information.

No response

kriegste commented 2 months ago

Have you tried leaving intr_type at default (no interrupt), then add the handler using gpio_isr_handler_add() before calling gpio_set_intr_type() at the end?

amoldeshpande commented 2 months ago

tried that out just now. Didn't change anything.

kriegste commented 2 months ago

Oh, and if you have a level interrupt it will fire again as soon as the handler is left. This triggers the watchdog. Try an edge interrupt.

amoldeshpande commented 2 months ago

I see. That's probably what it is.

I tried ANYEDGE and RISING and FALLING, but they didn't trigger the ISR, so I was trying out LOW_LEVEL.

Those others would be edge-triggered, right ?

o-marshmallow commented 2 months ago

Hello @amoldeshpande ,

As @kriegste said, the issue is that the CPU enters your GPIO ISR handler again and again since the level of your GPIO has not been changed. What you want to do in your ISR is to make sure your device doesn't assert the GPIO anymore and according to the CC1101 datasheet, it depends on how you configured it.

For example, if the device's GDOx_CFG register is set to 0, then you get an interrupt when the RX FIFO size has reached its "full" threshold. In that case, you should trigger a transfer from the ESP32 to your device to let the latter empty its RX FIFO (According to the datasheet: De-asserts when RX FIFO is drained below the same threshold.)

If there is another way (faster?) to let the device de-assert its GPIO while you could defer the transfer to a Task, it would be even better if the serial communication between the ESP32 and CC1101 is slow.

amoldeshpande commented 2 months ago

so, I am not using the FIFOs of the CC1101. I'm trying to use the "Asynchronous serial mode", where the data is delivered through GDO2 .

Maybe I'm misunderstanding how interrupts work in this case, but I would have expected that if I set the interrupt type in ESP-IDF to "ANYEDGE", I should get an interrupt for each time the radio sends a bit.

Please note that at this time the radio is not even transmitting. So I don't know where the spurious interrupts are coming from. It's not just for LOW-type interrupts. HIGH also has the same crash. I don't understand why there is even an interrupt in this case.

Obviously, I'm new to esp32 and ESP-IDF, so I must be doing something wrong. I only wish I knew what it was :-)

Anyway, I might try Arduino ESP next since there is example code out there that does exactly what I need.

For example, in this code at https://github.com/rstrouse/ESPSomfy-RTS/blob/main/Somfy.cpp

if(this->config.enabled) {
      rxmode = 1;
      pinMode(this->config.RXPin, INPUT);
      interruptPin = digitalPinToInterrupt(this->config.RXPin);
      ELECHOUSE_cc1101.SetRx();
      //attachInterrupt(interruptPin, handleReceive, FALLING);
      attachInterrupt(interruptPin, handleReceive, CHANGE);
      Serial.printf("Enabled receive on Pin #%d Timing: %ld\n", this->config.RXPin, millis() - timing);
    }

This software works just fine when I flash it to my esp32, so it's not my hardware that is faulty.