I have an LM75 temperature sensor connected to a
STM8, 80KHz I2C peripheral. the devices on the bus consist of this sensor and an I2C character LCD (PCF8574T). the LCD works perfectly fine but the temperature sensor, returns a temperature much under the actual value, but if I disconnect it (all pins) and reconnect it, it becomes normal. because all libraries are written by myself, I don't consider them fault proof so I included the logic analyzer outputs. the first write command to chip, is for setting internal register pointer, which is temperature. temperature register is 16 bits, which the MSB is the real part and the LSB is don't care (except the MSbit of LSB). the BAD one which reads 6 degrees which is wrong (I FEEL it!):
and the GOOD one, same sensor after disconnecting and connecting it again. (the data temperature reads are in HEX, so it's 21 degrees)
what I've done so far ? (without any luck abviously)
- the logic level and supply voltages, are 5 volts
- I've tried 2 sensors, same sensor PCB shape, various connection cables. they have on board bypass caps.
- the wrong temperature goes up when I touch the chip and with the same rate as the working case.
- I've tried various I2C speed. from 50 to 100 and 200KHz. the clock speed is checked on Logic analyzer.
- the cable length is under 30cm
- there are two sda/scl pull-up pairs. one pair on the main PCB (where the MCU is located) and another one on the LCD board. I've tried sensors with and without pullups on board. no luck. the pull-ups are 10K, and are pulled up to 5 volts.
what would be the problem ?