HTS221 blocks SDA line
I tried to connect the HTS221 to the ATtiny816 via the I2C bus. The data availability survey was conducted 2 times per second:
if ((HTS221_GetCTRL_REG2() == 0) && ((HTS221_GetStatus() & 0x03) == 0x03)) {
HTS221_GetData(&HTS221_Rx_buf);
...
}
Oscillograms of STL and SDA lines were correct, regardless of the amount of received data (1..4 bytes).
Converting the resulting data resulted in correct humidity and temperature results.
However, with constant interrogation of the sensor, SDA line was blocked in the lower state in a random time. And further work was resumed only with the re-power on the Vdd.
This lock occurred both in case of auto-increment reading of results registers, and one at a time. This block occurred both during the automatic start of the conversion (tried 1 and 7 Hz) and “one-shot�?.
The blocking of SDA lines was resolved only in the case of reading only one register, for example HUMIDITY_OUT_H. This allows to obtain humidity with an accuracy of 1%.
void HTS221_GetData(HTS221_data_t* Buf)
{
SubAddress = 0x28 | 0x80; // from HUMIDITY_OUT_L
I2C_SUB_IN(&Buf->bytes.H_OUT_byte0, HTS221RdAddr, 2); // 2 bytes
}
<----- Does not work long !!!
void HTS221_GetData(HTS221_data_t* Buf)
{
SubAddress = 0x29; // from HUMIDITY_OUT_H
I2C_SUB_IN(&Buf->bytes.H_OUT_byte1, HTS221RdAddr, 1); // ONLY 1 BYTE
}
<------ It works long enough !!!
