About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

Pi3+, IO+ and OSError: [Errno 121] Remote I/O error

68 Views - Created 42 days ago

42 days ago

Posted by:
cncman

Last edited: 14/12/2021

Users Avatar

Hi,

I have Pi3+, Debian Bullseye 64bit and  IO+ board which works for some time but aborts with "OSError: [Errno 121] Remote I/O error", no matter what I have tried to tune config.txt.

There is RTC clock connected (from Aliexpress but they seem to be all similar), pigpio daemon running for encoder (currently disconnected), and pyfirmata to control step motors via USB and Arduino Due/AccelStepper.

Current parameters:
 

dtparam=i2c_arm=on,i2c_arm_baudrate=100000
dtoverlay=i2c-rtc,ds3231
enable_uart=1
dtoverlay=pi3-disable-bt
core_freq=250
dtoverlay=vc4-fkms-v3d
gpu_mem=128 # Switched from CMA to discrete value

# for PIGPIO
iomem=relaxed
strict-devmem=0

This error occurs quite shortly, even without sending any data via Firmata to Arduino, and PIGPIO just running idle. IO+ is connected to 8-relay board and ena/dir pins of TB6600 and DM556 (all from Aliexpress ).

  File "/home/pi/LinW/BA_cnc_iopiplus.py", line 64, in cnc_iopiplus_set_pin
    bus_obj.write_pin(pin, state)
  File "/usr/local/lib/python3.9/dist-packages/IOPi/IOPi.py", line 509, in write_pin
    self.__set_pin(pin, value, self.GPIOA, self.GPIOB)
  File "/usr/local/lib/python3.9/dist-packages/IOPi/IOPi.py", line 246, in __set_pin
    curval = self.__bus.read_byte_data(self.__ioaddress, reg)
OSError: [Errno 121] Remote I/O error

Any idea what is going wrong?
Thanks in advance.

41 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hi

The problem you are having is most likely caused by a conflict between the IO Pi and the RTC.

Linux will periodically communicate with the RTC.  When this happens the I2C bus is blocked from all other communication so if you try to access the IO Pi at the same time you will get a Remote I/O error.

The easiest way to get around this problem is to use a try/except around the write_pin function call in python code and if an error occurs wait for a few milliseconds and try repeating the write_pin call.

The other option would be to disable the i2c-rtc and ds3231 overlays and write a python program to manually get the date and time from the ds3231 and update the system time when the Raspberry Pi boots.

AB Electronics UK Tech Support

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.