From 52179cea24822b5606fb7016a1b99ab09c01241f Mon Sep 17 00:00:00 2001 From: mrtoy-me <118446898+mrtoy-me@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:03:37 +1000 Subject: [PATCH] SHT3xd component - Provide example i2c configuration for >50-100Khz i2c frequencies on IDF (#3921) * Update for higher i2c frequencies on IDF * Update sht3xd.rst --- components/sensor/sht3xd.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/sensor/sht3xd.rst b/components/sensor/sht3xd.rst index 3f71cad44..73a968f49 100644 --- a/components/sensor/sht3xd.rst +++ b/components/sensor/sht3xd.rst @@ -54,6 +54,24 @@ Configuration variables: but can also increase temperature readings and decrease humidity readings as a side effect. Defaults to ``false``. +I²C Configuration when using Higher I²C Frequencies +--------------------------------------------------- + +When using the **IDF framework** and **I²C frequencies greater than 50-100kHz**, the I²C configuration needs to include a **timeout** option. +On an ESP32, the Arduino framework has a default I²C timeout of 50ms whereas on IDF framework, the default timeout is 100us. +At these higher I²C frequencies, the default I²C timeout on IDF framework causes a "Communication with SHT3xD failed" error on setup. +A solution that has been tested on ESP32 at 800kHz, is to increase the I²C timeout to 10ms as per the following example. + +.. code-block:: yaml + + # Example I²C configuration + i2c: + sda: 21 + scl: 22 + scan: true + frequency: 800khz + timeout: 10ms + See Also --------