sht3x: reads should be retried with at least 0.5s pause

SHT3x would return a read NACK on host retries.
When the MCU receives the I2C CMD, it reads out data.
SHT3x clears the data buffer.
The MCU fails to deliver a response to the host.
The host retries, the device returns NACK,
then the MCU goes into the shutdown state.

Make sure there is at least 0.5s between retries.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets
2025-07-03 21:50:35 +02:00
committed by KevinOConnor
parent 37ddab223f
commit 2585accfeb
2 changed files with 17 additions and 3 deletions

View File

@@ -217,8 +217,8 @@ class MCU_I2C:
def i2c_write_wait_ack(self, data, minclock=0, reqclock=0):
self.i2c_write_cmd.send_wait_ack([self.oid, data],
minclock=minclock, reqclock=reqclock)
def i2c_read(self, write, read_len):
return self.i2c_read_cmd.send([self.oid, write, read_len])
def i2c_read(self, write, read_len, retry=True):
return self.i2c_read_cmd.send([self.oid, write, read_len], retry)
def MCU_I2C_from_config(config, default_addr=None, default_speed=100000):
# Load bus parameters