1
\$\begingroup\$

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!):

LM75 I2C bad temp read

and the GOOD one, same sensor after disconnecting and connecting it again. (the data temperature reads are in HEX, so it's 21 degrees)

LM75 I2C good temp read

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 ?

\$\endgroup\$
7
  • \$\begingroup\$ Doesn't make sense. You need to capture actual SCL and SDA waveform to understand if this is a noise issue or something else. \$\endgroup\$ Nov 24, 2020 at 17:09
  • \$\begingroup\$ @AdamLawrence you mean using an o'scope? in the above logic plots, D0 is SDA and D1 is SCL. \$\endgroup\$ Nov 24, 2020 at 17:17
  • \$\begingroup\$ @TirdadSadriNejad Yes but that is a logic analyzer capture. It shows only digital ones and zeroes above and below some threshold voltage. If you have an analog waveform problem, the logic analyzer capture would not show that, but a oscilloscope capture would. What value pull-ups there are? All devices and pull-ups are to 5V? \$\endgroup\$
    – Justme
    Nov 24, 2020 at 19:07
  • \$\begingroup\$ @Justme unfortunately I don't have an oscope at reach, but I think I have to find one. the pullups are all 10K, pulled up to 5 volts. I've updated the post. \$\endgroup\$ Nov 24, 2020 at 20:06
  • \$\begingroup\$ 10k pull-ups seem weak. And yes I mean an o-scope. Logic analyzers can get confused by noisy or slow-edge signals. \$\endgroup\$ Nov 24, 2020 at 20:11

1 Answer 1

2
\$\begingroup\$

well the problem was fake/defective chips. despite I knew they couldn't be originals, but I thought the whole difference would be a few degrees in temperature that wasn't very bad for my purpose. but I didn't expect a total I2C failure in 5 new chips in a row! if I didn't change one of them with another batch by chance, I wouldn't know and I would have wasted 3 weeks diggin the whole hardware and software from the ground up. lesson learned.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.