Skip to content

Commit 7fe7c55

Browse files
fivdidpgeorge
authored andcommitted
esp32/machine_timer: Fix ESP32C3 timer period doubling.
The original ESP32 only supports timer source clock APB so it doesn't need and doesn't have a clk_src field. The ESP32C3 supports timer source clock APB and XTAL so it does have a clk_src field, and this needs to be configured to get the correct period. Fixes micropython#8084.
1 parent a67989a commit 7fe7c55

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/esp32/machine_timer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ STATIC void machine_timer_enable(machine_timer_obj_t *self) {
189189
config.divider = TIMER_DIVIDER;
190190
config.intr_type = TIMER_INTR_LEVEL;
191191
config.counter_en = TIMER_PAUSE;
192+
#if SOC_TIMER_GROUP_SUPPORT_XTAL
193+
config.clk_src = TIMER_SRC_CLK_APB;
194+
#endif
192195

193196
check_esp_err(timer_init(self->group, self->index, &config));
194197
check_esp_err(timer_set_counter_value(self->group, self->index, 0x00000000));

0 commit comments

Comments
 (0)