Error 121 for I2C devices


#1

I recently purchased a piano hat, which I have been attempting to get working. Unfortunately, it has not been responsive through various tests, providing error 121 (IOError in python2, OSError in python3) “Remote I/O error”.
The following are true about my system:

  1. I have I2C enabled.
  2. I have the libraries installed. I first did this through PIP, but under the theory that the configuration script would find the problem, I ran that too.
  3. I2C functions with things I’ve had for a while, such as my I2C-mounted display.
  4. The hat is attached firmly with spacers, so there is little chance that it has become disconnected physically. In the theory that the thinner header on the hat would make connections unstable, I also tried physically holding it to the pins, with no result.
  5. I have seen online that this error could be caused by badly-attached pins on pi zeros. This doesn’t apply to my situation, because I am using a raspberry pi 3, so am using the standard headers. I attempted the same on an old pi 2, with identical results.
  6. I also saw somewhere that this could be caused by an insufficient power supply. I have a strong power supply at 2.5 A from the mains.
  7. The error happens identically whether I run my own code, code in the REPL, the examples from the git repo, etc. It also happens identically with the privileges I give the program.

While attempting to diagnose this, I found a friend who has a Pimoroni button SHIM, and attempted to use that as well. I get identical errors with that too.
Does anyone know what could cause this? I suppose it is possible that my piano hat is physically faulty, and my friend has not used her button SHIM for many months so that too could have developed a fault. However, this seems entirely too coincidental, so I assume there is a software remedy. My searching, sadly, does not show it.
Thank you for your assistance.


#2

If you run i2cdetect -y 1 on that Pi does it show any detected addresses?
I’d run it with the Piano Hat firmly attached, and again with it removed and other i2c devices you know work attached.


#3

Neither device shows anything when running i2cdetect. My display does show up in the list when connected. This is especially surprising for the button SHIM, which fits between the pi and the screen (or plain female header in the theory that the SHIM and screen might conflict), yet remains undetected.


#4

Not familiar with either device, but if they both have an eprom on them there will be a conflict. Only one eprom can be active. There are some passive I2C devices that only listen on the I2C bus and will not appear ini2detect.
Also have you checked to insure there is no I2C address conflict?


#5

The button shim, as far as I can tell, needs to be soldered to the header, or have its own header attached to it to be detected and work. The pictures on the product page show it as soldered on.


The piano hat needs to be firmly pressed down to make good contact with the GPIO pins. Using standoffs that are too long will also fail to give you a good contact. I used a booster header with my Piano hat to get the correct spacing for the headers I had on hand. I also needed it to provide enough space between my Piano hat and Pi to clear the tall heatsink I had on my Pi.


#6

The screen I’m using (adafruit PiTFT) has an address of 0x37. The piano hat uses 0x28 and 0x2b, and also those don’t fit together so are not simultaneously running them. I don’t know what the button SHIM’s I2C address is because the pinout link is broken. I suppose that could conflict with the screen, but it does not act different when the screen is not there; I only try the screen to confirm that I2C still functions for something.


#7

Pinout for the button shim is here, https://pinout.xyz/pinout/button_shim# Doesn’t list what i2c address(s) it uses though? According to the product page the IO expander on it uses (0x3f)


#8

The button shim likely just isn’t making a good contact to be detected. The Piano Hat seems to have an issue though, and may very well be defective. If you go to the Shop Page and scroll down to the bottom of the page there is a contact Us like. That will put you in touch with somebody from Pimoroni. I’d also put a link to this thread in your e-mail to them.