Using new timer of GPTimer

kot_schrodingera
Posts: 3
Joined: Tue Mar 21, 2023 2:07 pm

Using new timer of GPTimer

Postby kot_schrodingera » Tue Mar 21, 2023 2:13 pm

Hello!

I migrated from 4.4 to 5.0.1
I'm trying run example for gptimer and getting message:
D (332) gptimer: new group (0) @0x3ffb6c64
D (336) gptimer: new gptimer (0,0) at 0x3ffb6bb8, resolution=1000000Hz
I (343) system: Enable timer
I (346) system: Start timer, stop it at alarm event
I (1352) system: Timer stopped, count=1000002
I (1352) system: Set count value
I (1352) system: Get count value
I (1354) system: Timer count value=lu
I (1358) system: Disable timer
I (1362) system: Enable timer
I (1365) system: Start timer, auto-reload at alarm event
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).

Setting breakpoint at 0x00000000 and returning...


If I turn off autoreload, then example is work correct.

What can I do?

Best regards
Alex

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Using new timer of GPTimer

Postby ESP_Sprite » Wed Mar 22, 2023 1:13 am

Hard to say without the code, but you're likely trying to do something in an ISR that you shouldn't do in an ISR. (Specifically, you can't call functions that block in any way, shape or form, which includes most of the more complex ESP-IDF API calls.)

kot_schrodingera
Posts: 3
Joined: Tue Mar 21, 2023 2:07 pm

Re: Using new timer of GPTimer

Postby kot_schrodingera » Wed Mar 22, 2023 5:55 am

No, I found problem.
I'm using c++ and if I rename main.cpp to main.c than all work.

kot_schrodingera
Posts: 3
Joined: Tue Mar 21, 2023 2:07 pm

Re: Using new timer of GPTimer

Postby kot_schrodingera » Wed Mar 22, 2023 6:03 am

I'm sorry, I'm stupid man.

gptimer_alarm_config_t struct in c++ initialize like

Code: Select all

gptimer_alarm_config_t alarm_config2 = {
        1000000, // period = 1s
        0,
        true,
    };
- it's correct code, and I mix 1000000 and 0.

Thanks

Who is online

Users browsing this forum: Baidu [Spider], ignisuti and 84 guests