microsoft / jacdac-stm32x0

Jacdac implementation for STM32F0 and similar
MIT License
11 stars 10 forks source link

shtc3 I2C lockup #26

Open jamesadevine opened 3 years ago

jamesadevine commented 3 years ago

It seems that the SHTC3 regularly experiences an I2C lockup on the temperature and humidity module.

https://github.com/microsoft/jacdac-c/blob/master/drivers/shtc3.c#L77

hw_panic is called because i2c_read_ex returns -1 which is evaluated as true. It seems that after some time, the lockup becomes more severe and cannot be recovered by a device reset alone.

We should include code to unlock the bus instead.