Merge branch 'fix/fix_esp_timer_accuracy_when_do_dfs_v5.4' into 'release/v5.4'

fix(esp_hw_support): improve esp timer accuracy on DFS for esp32 & esp32s2 (v5.4)

See merge request espressif/esp-idf!39340
This commit is contained in:
Jiang Jiang Jian
2025-05-26 19:46:58 +08:00
13 changed files with 352 additions and 78 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,24 @@
#pragma once
#include <stdint.h>
#include "sdkconfig.h"
#if CONFIG_ESP_TIMER_IMPL_TG0_LAC
/* Selects which Timer Group peripheral to use */
#define LACT_MODULE 0
/* Desired number of timer ticks per microsecond.
* This value should be small enough so that all possible APB frequencies
* could be divided by it without remainder.
* On the other hand, the smaller this value is, the longer we need to wait
* after setting UPDATE_REG before the timer value can be read.
* If LACT_TICKS_PER_US == 1, then we need to wait up to 1 microsecond, which
* makes esp_timer_impl_get_time function take too much time.
* The value LACT_TICKS_PER_US == 2 allows for most of the APB frequencies, and
* allows reading the counter quickly enough.
*/
#define LACT_TICKS_PER_US 2
#endif
// we assign the systimer resources statically
#define SYSTIMER_COUNTER_ESPTIMER 0 // Counter used by esptimer, to generate the system level wall clock