This is the code we are using for read LM75 sensor. As you can see we have set a maximum wait of 10 ms in the i2c_master_cmd_begin function, but we are observing 1 second timeouts.
Code: Select all
esp_err_t ret;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (addr_lm75 << 1 | I2C_MASTER_WRITE), I2C_MASTER_ACK);
i2c_master_write_byte(cmd, reg_lm75, I2C_MASTER_ACK);
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (addr_lm75 << 1 | I2C_MASTER_READ), I2C_MASTER_ACK);
if (length_lm75 > 1)
{
i2c_master_read(cmd, val_lm75, length_lm75 - 1, I2C_MASTER_ACK);
}
i2c_master_read_byte(cmd, val_lm75 + length_lm75 - 1, I2C_MASTER_NACK);
i2c_master_stop(cmd);
ret = i2c_master_cmd_begin(I2C_NUM_0, cmd, pdMS_TO_TICKS(10));
i2c_cmd_link_delete(cmd);
return ret;