I2C write error

#1

I am using a SHT31 sensor with the SHT31 I2C library. It seems to work correctly measuring temperature and humidity values, but I sometimes get the error

mgos_sht31.c:35 I2C=0x44 cmd=9216 (0x2400) write error

What does this error entail and how to solve it, if it is actually a problem?

#2

If you get the datasheet and read it, you’ll find 0x2400 means “single shot high repeatability measurement”. The write error seems to indicate that the measurement could not start.
You should find the reason why that is happening, which looks like hardware problems.
Do you have proper pull-ups for your bus speed ? Are you using the correct voltage ? Cable length ? Bus capacitance ? Did you see the signals with an oscilloscope ?
If signals look good and everything seems to be correct, then grabbing the dialog with a logic analyzer can shed some light on what is going on. In this case looks like the write transaction is not taking place but it could also be interrupted; you should always see real life with proper measurement tools.
On the software side, are you perhaps polling too frequently ? Could one of your polls interrupt another one taking place at that moment ?

#3

Thanks a lot! I think our problems might have to do with polling too frequently, as two polls could interrupt one another under certain conditions.