ESP32 Freertos Timer error "unsupported clock source"

krutika.hardade
Posts: 3
Joined: Fri Jul 22, 2022 12:08 pm

ESP32 Freertos Timer error "unsupported clock source"

Postby krutika.hardade » Mon Jul 25, 2022 11:02 am

I am trying to initialize timer module in FreeRTOS on ESP32 Module. But it gives me the following errors :

Code: Select all

 Heap Size = 272208 

Stack Rem = 2540 

assert failed: timer_ll_set_clock_source /IDF/components/hal/esp32/include/hal/timer_ll.h:38 (false && "unsupported clock source")


Backtrace:0x40081b92:0x3ffb85600x40086e15:0x3ffb8580 0x4008c679:0x3ffb85a0 0x400d9e76:0x3ffb86c0 0x400d5b30:0x3ffb8700 0x40089c79:0x3ffb8720
Here is code for timer init :

Code: Select all

void Timer_init(void)
{
    uint64_t u32Test = 0;

    /* Select and initialize basic parameters of the timer */
    timer_config_t config = {
        .divider = TIMER_DIVIDER,
        .counter_dir = TIMER_COUNT_UP,
        .counter_en = TIMER_PAUSE,
        .alarm_en = TIMER_ALARM_EN,
        .auto_reload = TIMER_WITHOUT_RELOAD,
    }; // default clock source is APB
    timer_init(TIMER_GROUP_0, TIMER_0, &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(TIMER_GROUP_0, TIMER_0, 0x00000000ULL);

    /* Configure the alarm value and the interrupt on alarm. */
    timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, TIMER_INTERVAL10_SEC * TIMER_SCALE);

    timer_enable_intr(TIMER_GROUP_0, TIMER_0);
    timer_isr_register(TIMER_GROUP_0, TIMER_0, Timer0_ISR,NULL, ESP_INTR_FLAG_IRAM, NULL);
}
Following configurations are used in FreeRTOSConfig.h file

Code: Select all

// ------------------- Software Timer ----------------------

#define configUSE_TIMERS                       1
#define configTIMER_TASK_PRIORITY              CONFIG_FREERTOS_TIMER_TASK_PRIORITY
#define configTIMER_QUEUE_LENGTH               CONFIG_FREERTOS_TIMER_QUEUE_LENGTH
#define configTIMER_TASK_STACK_DEPTH           CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH
Could you please help me on this.
Attachments
advfreertos2.png
error
advfreertos2.png (215.84 KiB) Viewed 2359 times

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

Re: ESP32 Freertos Timer error "unsupported clock source"

Postby ESP_Sprite » Tue Jul 26, 2022 3:09 am

Note that this has nothing to do with FreeRTOS; you're trying to initialize an ESP32 timer. What specific version of ESP-IDF are you using?

krutika.hardade
Posts: 3
Joined: Fri Jul 22, 2022 12:08 pm

Re: ESP32 Freertos Timer error "unsupported clock source"

Postby krutika.hardade » Tue Jul 26, 2022 6:04 am

Following version i am using..

ESP-IDF v5.0-dev-3043-g70109e2393-dirty

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

Re: ESP32 Freertos Timer error "unsupported clock source"

Postby ESP_Sprite » Tue Jul 26, 2022 7:28 am

I think it's a bug in the current master. Please try changing your code to this:

Code: Select all

    timer_config_t config = {
        .divider = TIMER_DIVIDER,
        .counter_dir = TIMER_COUNT_UP,
        .counter_en = TIMER_PAUSE,
        .alarm_en = TIMER_ALARM_EN,
        .auto_reload = TIMER_WITHOUT_RELOAD,
        .clk_src = TIMER_SRC_CLK_AHB   //<-- add this line
    };
I'll also raise an issue so in the future, the code as you wrote it will work again.

krutika.hardade
Posts: 3
Joined: Fri Jul 22, 2022 12:08 pm

Re: ESP32 Freertos Timer error "unsupported clock source"

Postby krutika.hardade » Wed Jul 27, 2022 10:25 am

Thanks

Who is online

Users browsing this forum: Baidu [Spider] and 138 guests