Simple Timer Interrupt Not Working
Posted: Mon Nov 11, 2019 11:33 am
I am trying to run timer interrupt with below code. But I can't see the print (printf("timer_group0_isr OK!\n")) I must to see.
AppMain:
Do I need to make a setting in Menuconfig?
Code: Select all
static void timer_group0_isr(void* arg) {
printf("timer_group0_isr OK!\n");
TIMERG0.int_clr_timers.t0 = 1;
TIMERG0.hw_timer[0].config.alarm_en = 1;
}
void timer_tg0_initialise (int timer_idx) {
timer_config_t config = {
.alarm_en = true,
.counter_en = false,
.intr_type = TIMER_INTR_LEVEL,
.counter_dir = TIMER_COUNT_UP,
.auto_reload = true,
.divider = 80
};
timer_init(TIMER_GROUP_0, timer_idx, &config);
timer_set_counter_value(TIMER_GROUP_0, timer_idx, 0);
timer_set_alarm_value(TIMER_GROUP_0, timer_idx, 10000);
timer_enable_intr(TIMER_GROUP_0, timer_idx);
timer_isr_register(TIMER_GROUP_0, timer_idx, timer_group0_isr, (void *) timer_idx, ESP_INTR_FLAG_IRAM, NULL);
timer_start(TIMER_GROUP_0, timer_idx);
printf("timer initialzied!!!!\n");
}
Code: Select all
timer_tg0_initialise(TIMER_0);