I2C - [Errno 121] Remote I/O error
Symptoms:
i2cdetect -y 1 reports ID:s sometimes, sometimes not
Running calls to the I2C device, in this case an INA219 module caused this error:
Traceback (most recent call last):
File "/ina219.py", line 12, in <module>
ina.configure()
File "/usr/local/lib/python3.9/dist-packages/ina219.py", line 173, in configure
self._calibrate(
File "/usr/local/lib/python3.9/dist-packages/ina219.py", line 310, in _calibrate
self._calibration_register(calibration)
File "/usr/local/lib/python3.9/dist-packages/ina219.py", line 356, in _calibration_register
self.__write_register(self.__REG_CALIBRATION, register_value)
File "/usr/local/lib/python3.9/dist-packages/ina219.py", line 388, in __write_register
self._i2c.writeList(register, register_bytes)
File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 127, in writeList
self._bus.write_i2c_block_data(self._address, register, data)
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 368, in write_i2c_block_data
self._device.write(data)
OSError: [Errno 121] Remote I/O error
Reason and solution:
The reason for this was a sunken GND pin on the Raspberry Pi header that made the connection unstable. Soldering it back to position solved the problem.
This is a personal note. Last updated: 2023-01-20 21:10:21.



