2

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

 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 :

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

// ------------------- 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.

enter image description here

krutika
  • 21
  • 2
  • 2
    C will initialize `config.clk_src` to 0. But the default clock doesn't have value 0. Try `.clk_src = TIMER_SRC_CLK_DEFAULT,` instead. – Codo Jul 25 '22 at 11:28

0 Answers0