From 43e83b8324a721544b336217bc778ee93e1f388f Mon Sep 17 00:00:00 2001 From: "C.S.M" Date: Mon, 24 Mar 2025 14:01:07 +0800 Subject: [PATCH] fix(i2c_master): Fix the stretch happen cause timeout in probe, Closes https://github.com/espressif/esp-idf/issues/15589 --- components/esp_driver_i2c/i2c_master.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/esp_driver_i2c/i2c_master.c b/components/esp_driver_i2c/i2c_master.c index d1cd6ea8d0..31a649a25d 100644 --- a/components/esp_driver_i2c/i2c_master.c +++ b/components/esp_driver_i2c/i2c_master.c @@ -1285,6 +1285,8 @@ esp_err_t i2c_master_probe(i2c_master_bus_handle_t bus_handle, uint16_t address, } i2c_ll_master_set_fractional_divider(hal->dev, 0, 0); i2c_ll_enable_intr_mask(hal->dev, I2C_LL_MASTER_EVENT_INTR); + // 20ms is sufficient for stretch, since there is no device config on probe operation. + i2c_hal_master_set_scl_timeout_val(hal, 20 * 1000, bus_handle->base->clk_src_freq_hz); i2c_ll_update(hal->dev); s_i2c_send_commands(bus_handle, ticks_to_wait);