UncleRus/esp-idf-lib

[sht3x]: i2cdev: Could not write to device [0x44 at 0]

FeOAr opened this issue · 6 comments

The issue

  • release version: 0.9.4
  • esp-idf version: 5.1.1

Snipaste_2024-03-30_21-46-22

I am using the example of SHT30, which can function normally when the I2C speed is 100K, but other chips can reach 200K using the same "i2cdev" lib. The last discovered issue may be that the i2c device was not fully configured before the first measurement. Just add a delay to use it normally.

void task(void *pvParameters)
{
    float temperature;
    float humidity;

    TickType_t last_wakeup = xTaskGetTickCount();
    vTaskDelay(pdMS_TO_TICKS(10));  // Add delay before measurement

    while (1)
    {
        // perform one measurement and do something with the results
        ESP_ERROR_CHECK(sht3x_measure(&dev, &temperature, &humidity));
        printf("SHT3x Sensor: %.2f °C, %.2f %%\n", temperature, humidity);

        // wait until 5 seconds are over
        vTaskDelayUntil(&last_wakeup, pdMS_TO_TICKS(1000));
    }
}

Which SDK are you using?

esp-idf

Which version of SDK are you using?

5.1.1

Which build target have you used?

  • esp32
  • esp32s2
  • esp32s3
  • esp32c2
  • esp8266
  • other

Component causing the issue

sht3x

Anything in the logs that might be useful for us?

E (320) i2cdev: Could not write to device [0x44 at 0]: -1 (ESP_FAIL)
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x4200870b

Additional information or context

No response

Confirmation

  • This report is not a question nor a request for drivers.