From dcfbac8c94c93279e91ee5529d2753078760155f Mon Sep 17 00:00:00 2001 From: "C.S.M" Date: Tue, 18 Feb 2025 17:17:48 +0800 Subject: [PATCH] fix(i2c): Fix scl frequency is wrong on esp32s2 in legacy i2c driver, Closes https://github.com/espressif/esp-idf/issues/15301, Closes https://github.com/espressif/esp-idf/issues/14603 --- components/driver/i2c/i2c.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/driver/i2c/i2c.c b/components/driver/i2c/i2c.c index e27fe6df37..b7b2291e0c 100644 --- a/components/driver/i2c/i2c.c +++ b/components/driver/i2c/i2c.c @@ -825,6 +825,9 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t *i2c_conf) #endif // SOC_I2C_SUPPORT_SLAVE { i2c_hal_master_init(&(i2c_context[i2c_num].hal)); + I2C_CLOCK_SRC_ATOMIC() { + i2c_ll_set_source_clk(i2c_context[i2c_num].hal.dev, src_clk); + } //Default, we enable hardware filter i2c_ll_master_set_filter(i2c_context[i2c_num].hal.dev, I2C_FILTER_CYC_NUM_DEF); I2C_CLOCK_SRC_ATOMIC() {