i have two timers for a esp32-s3 on esp-idf 5.0.2
I init the timers with:
Code: Select all
gptimer_config_t timer_config = {
.clk_src = GPTIMER_CLK_SRC_DEFAULT,
.direction = GPTIMER_COUNT_UP,
.resolution_hz = 1000000, // 1us
};
//Setup Callback
gptimer_event_callbacks_t cbs = {
.on_alarm = timer_interrupt_handler,
};
ESP_ERROR_CHECK(gptimer_new_timer(&timer_config, &timer_1));
ESP_ERROR_CHECK(gptimer_register_event_callbacks(timer_1, &cbs, (void*)8));
ESP_ERROR_CHECK(gptimer_enable(timer_1));
ESP_ERROR_CHECK(gptimer_new_timer(&timer_config, &timer_2));
ESP_ERROR_CHECK(gptimer_register_event_callbacks(timer_2, &cbs, (void*)9));
ESP_ERROR_CHECK(gptimer_enable(timer_2));
//Setup Alarms
timer_1_alarm_config ={
.alarm_count = 10000,
.reload_count = 0,
};
timer_1_alarm_config.flags.auto_reload_on_alarm = false;
timer_2_alarm_config ={
.alarm_count = 450000,
.reload_count = 0,
};
timer_2_alarm_config.flags.auto_reload_on_alarm = false;
ESP_ERROR_CHECK(gptimer_set_alarm_action(timer_1, &timer_1_alarm_config));
ESP_ERROR_CHECK(gptimer_set_alarm_action(timer_2, &timer_2_alarm_config));
E (4167944) gptimer: gptimer_start(370): timer is not enabled yet
I'm not sure what the problem is.
I tried initialising them the other way round. No change.
I tried initialising them at different points in the code. No change.