How to fix Remote I/O error while connecting to adafruit MPR 121 on Raspberry Pi Zero?

  adafruit, python, raspberry-pi

I have been trying to connect Adafruit MPR 121 to Raspberry Pi Zero. I have connected it as follows:
GPIO 2 – SDA, GPIO 3 – SCL, 3.3V – VIN, GND – GND (upper one).

I have enabled I2c via raspi-config.
Initialization looks like that:

cap = MPR121.MPR121()
if not cap.begin():
    print('Error initializing MPR121.  Check your wiring!')
    sys.exit(1)

At first, the code was working and I2C has successfully connected and it was possible to touch some pins and receive output.
sudo i2cdetect -y 0 was showing that it was connected on address 0x5a. Now I get an error:

Traceback (most recent call last):
  File "/home/pi/main.py", line 303, in <module>
    init()
  File "/home/pi/main.py", line 53, in init
    if not cap.begin():
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_MPR121/MPR121.py", line 93, in begin
    return self._reset()
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_MPR121/MPR121.py", line 97, in _reset
    self._i2c_retry(self._device.write8, MPR121_SOFTRESET, 0x63)
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_MPR121/MPR121.py", line 140, in _i2c_retry
    raise ex
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_MPR121/MPR121.py", line 136, in _i2c_retry
    return func(*params)
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 114, in write8
    self._bus.write_byte_data(self._address, register, value)
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 327, in write_byte_data
    self._device.write(data)
OSError: [Errno 121] Remote I/O error

It was appearing rarely before, but now I get it every single time.
Moreover, sudo i2cdetect -y 1 doesn’t show any connected devices.
I’ve checked wiring and it looks good to me.

Source: Python Questions

LEAVE A COMMENT