I2c stops working when another I2C device is connected


#1

I am using Touch phat for my raspberry pi zero. I’ve no problems with it, and sudo i2cdetect -y 1 shows that the i2c is detected. However, when I connect two more I2C devices (Adafuit INA219) with I2C address 0x40 and 0x41, all I2c devices including Touch phat stops working. sudo i2cdetect -y 1 shows no I2C device detected. Running my Touch phat script gives me:

Traceback (most recent call last):
  File "script.py", line 11, in <module>
    import touchphat
  File "/usr/lib/python2.7/dist-packages/touchphat/__init__.py", line 13, in <module>
    dh = cap1xxx.Cap1166(i2c_addr=0x2c)
  File "/usr/lib/python2.7/dist-packages/cap1xxx.py", line 283, in __init__
    self.product_id = self._get_product_id()
  File "/usr/lib/python2.7/dist-packages/cap1xxx.py", line 469, in _get_product_id
    return self._read_byte(R_PRODUCT_ID)
  File "/usr/lib/python2.7/dist-packages/cap1xxx.py", line 494, in _read_byte
    return self.i2c.read_byte_data(self.i2c_addr, register)
IOError: [Errno 121] Remote I/O error

The error goes away when I disconnect the INA219 units from my I2C port. I appreciate any advice on why this error is occuring and how I can resolve it.


#2

Are you powering the INA219 with 3.3v or 5v?

It looks like the INA219 has onboard pull-up resistors- the ones with 103 written on top are 10k. The schematic confirms this: https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout/downloads

The Pi has its own onboard 1.8k pull-ups to 3.3v, so additional pull-ups, especially if they are pulling to 5v, could be the source of your troubles.


#3

Thanks for your reply. I was powering with 5v, and I’ve just changed to 3v. It still didnt work. I soldered a spare INA219 and tried it, and that worked. I’m still not entirely certain why. If I were to guess, what I think might have happened is that the two INA219 units became spoiled or corrupted (perhaps an unforeseen inductive spike when I was testing my relay earlier on during the day). Hence, connecting these two (?corrupted) INA219 units with an intact touch phat night resulted in a failure for the raspberyr device to detect any I2C devices.


#4

Updates:
As mentioned, I’ve removed the two presumably ‘defective’ INA219 units, and insert a third INA219 unit. After about, a week, even this INA219 unit encountered the same problem (i.e. Remote I/O) error). This INA219 doesn’t work even when I disconnect touch phat from the rapsberry pi.

Now, vice versa, after disconnecting the INA219 from my rapsberry pi, when I try to launch the touch phat script, I get: File "touch_phat_demo.py", line 6, in <module> import touchphat File "/usr/lib/python2.7/dist-packages/touchphat/__init__.py", line 13, in <module> dh = cap1xxx.Cap1166(i2c_addr=0x2c) File "/usr/lib/python2.7/dist-packages/cap1xxx.py", line 286, in __init__ raise Exception("Product ID {} not supported!".format(self.product_id)) Exception: Product ID 0 not supported!
Thus, touch phat does not seem to be working as well. Could you advise me on this?

I’ve also checked the i2c, but I have some readings as shown here:

pi@raspberrypi:~/project$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

#5

It’s possible your pulling the i2c bus to +5v has irreversibly damaged the pins on your Pi, but it’s difficult to say with any certainty, and it would be strange for it to take time to manifest. Do you have any other i2c-compatible HATs or pHATs to test with?


#6

I’ve also tested the INA219 and touch phat on two other Raspberry Pis (zero and Pi 3), and the same problem persist. Could it be that pulling the i2c bus to +5v has first irreversibly damaged the pins on my Pi Zero, which then led to irreversible damage to the I2C periperal components?

I don’t have another I2C hat, but I’ve used a 9DOF I2C device from Adafruit and connected to my Raspberry Pi 3 (not the Raspberry Zero exposed to the +5v earlier on), sudo i2cdetect -y 1 shows:

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1f
20: -- 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

But no I2c reading for INA219, and running the touch phat script (with the touch phat stacked on to the Pi) gets me the Product ID not supported error.