mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
soc: fix wrong APB_CLK_FREQ value on esp32c6
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "driver/timer.h"
|
||||
#include "clk_tree.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#define TIMER_RESOLUTION_HZ 1000000 // 1MHz resolution
|
||||
@@ -62,9 +63,11 @@ static void example_tg_timer_init(example_timer_user_data_t *user_data)
|
||||
int group = user_data->timer_group;
|
||||
int timer = user_data->timer_idx;
|
||||
|
||||
uint32_t clk_src_hz = 0;
|
||||
ESP_ERROR_CHECK(clk_tree_src_get_freq_hz((soc_module_clk_t)TIMER_SRC_CLK_DEFAULT, CLK_TREE_SRC_FREQ_PRECISION_CACHED, &clk_src_hz));
|
||||
timer_config_t config = {
|
||||
.clk_src = TIMER_SRC_CLK_DEFAULT,
|
||||
.divider = APB_CLK_FREQ / TIMER_RESOLUTION_HZ,
|
||||
.divider = clk_src_hz / TIMER_RESOLUTION_HZ,
|
||||
.counter_dir = TIMER_COUNT_UP,
|
||||
.counter_en = TIMER_PAUSE,
|
||||
.alarm_en = TIMER_ALARM_EN,
|
||||
|
||||
Reference in New Issue
Block a user