Hardware Timer - Auto Reload Function -Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)

Mahonroy
Posts: 7
Joined: Tue Sep 21, 2021 10:53 pm

Hardware Timer - Auto Reload Function -Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)

Postby Mahonroy » Tue Dec 21, 2021 9:07 pm

Hello, I am using an "ESP32-WROOM-32UE (16MB)". I set up a hardware timer, and if I have the auto reload function enabled (e.g. "TIMER_AUTORELOAD_EN") everything works fine. If I disable the auto reload function (e.g. "TIMER_AUTORELOAD_DIS"), as soon as the timer is up, I get the error "-Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)".

Here is the function I am using that has the problem (in this instance, group number and timer number are both "0"):

Code: Select all

bool IntervalTimer::beginCycles(timer_isr_t isr_handler, intPeriod Period, bool scale )
{
    // Find next available timer
    timerID = getNextAvailableTimer();
    if(timerID < 0){ return false; }
    timerAvailable[timerID] = false; // Claim this timer and make it unavailable
    groupNumber = (timer_group_t)getGroup(timerID);
    timerNumber = (timer_idx_t)getGroupTimer(timerID);

    timer_config_t config = {
        .alarm_en = TIMER_ALARM_EN,
        .counter_en = TIMER_PAUSE,
        .intr_type = TIMER_INTR_LEVEL,
        .counter_dir = TIMER_COUNT_UP,
        .auto_reload = TIMER_AUTORELOAD_DIS,//MAKE SURE THIS IS DISABLED FOR ACTUAL USE
        .divider = 16,
    }; // default clock source is APB
    timer_init(groupNumber, timerNumber, &config);

    // Timer's counter will initially start from value below.
    // Also, if auto_reload is set, this value will be automatically reload on alarm
    timer_set_counter_value(groupNumber, timerNumber, 0);

    // Configure the alarm value and the interrupt on alarm.
    if(Period == 833)
    {
        timer_set_alarm_value(groupNumber, timerNumber, 2085); // 833.33uS or 1200 baud //16div = 2083.2927, 1230uS or 813 baud = 3075
    }
    else if(Period == 1230)
    {
        timer_set_alarm_value(groupNumber, timerNumber, 3075); // 1230uS or 813 baud = 3075
    }
    
    timer_enable_intr(groupNumber, timerNumber);
    timer_isr_callback_add(groupNumber, timerNumber, isr_handler, 0, 0);
    timer_start(groupNumber, timerNumber);

    return true;
}
This is how I am using it:

Code: Select all

    IntervalTimer rxTimer;
    rxTimer.begin((timer_isr_t)testISR, 833, uSec);
And here is the ISR function that is being called as soon as the time is up:

Code: Select all

bool alternate = true;

void testISR()
{
    if(alternate)
    {
        gpio_set_level((gpio_num_t)5, 1);
        alternate = false;
    }else{
        gpio_set_level((gpio_num_t)5, 0);
        alternate = true;
    }
}
If I comment out the line "timer_isr_callback_add(groupNumber, timerNumber, isr_handler, 0, 0);" then I don't get the error (and consequently my program doesn't work). So it seems like it has to do with the callback, but I can't figure out what the problem is. I even tried making the callback function blank. And like I mentioned, leaving everything untouched, and only changing ".auto_reload" to "TIMER_AUTORELOAD_EN", everything works.

This was the example I was basing my code off, and they use auto-reload enabled and disabled, so I don't understand why mine does not work:

https://github.com/espressif/esp-idf/bl ... ple_main.c

And this is the exact ESP32 I am using ( ESP32-WROOM-32UE (16MB) )

Any help or advice on this is greatly appreciated, as I am currently stuck on this problem. Thanks!

eliott
Posts: 18
Joined: Sat Mar 28, 2020 11:57 am

Re: Hardware Timer - Auto Reload Function -Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)

Postby eliott » Tue Oct 18, 2022 2:25 pm

Hello,

I meet the same problem, have you solved it ?

Eliott.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 203 guests