diff --git a/components/hal/esp32c2/include/hal/uart_ll.h b/components/hal/esp32c2/include/hal/uart_ll.h index aaea6e74ff..8d38c0e9e1 100644 --- a/components/hal/esp32c2/include/hal/uart_ll.h +++ b/components/hal/esp32c2/include/hal/uart_ll.h @@ -11,6 +11,7 @@ #pragma once #include "hal/uart_types.h" #include "soc/uart_periph.h" +#include "hal/clk_tree_ll.h" #ifdef __cplusplus extern "C" { @@ -157,7 +158,7 @@ static inline uint32_t uart_ll_get_sclk_freq(uart_dev_t *hw) case 2: return RTC_CLK_FREQ; case 3: - return XTAL_CLK_FREQ; + return clk_ll_xtal_load_freq_mhz() * MHZ; } } diff --git a/components/soc/esp32c2/include/soc/soc.h b/components/soc/esp32c2/include/soc/soc.h index 1f5f9a098f..b4ff43d342 100644 --- a/components/soc/esp32c2/include/soc/soc.h +++ b/components/soc/esp32c2/include/soc/soc.h @@ -148,7 +148,6 @@ #define APB_CLK_FREQ ( 40*1000000 ) #define REF_CLK_FREQ ( 1000000 ) #define RTC_CLK_FREQ (20*1000000) -#define XTAL_CLK_FREQ (40*1000000) #define UART_CLK_FREQ APB_CLK_FREQ #define WDT_CLK_FREQ APB_CLK_FREQ #define TIMER_CLK_FREQ (80000000>>4) //80MHz divided by 4