Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum


3240 Views - Created 18/12/2015


Posted by:

amer.rubyie Avatar

I have project that required 48 output(relays), I am using 2 IO PI. the project idea is fetch data from lists and send them to pins, the problem is: after few cycles system halt with this error.
I am using raspberry pi 2
Hope I can find help and thank you in advance
(", line 199, in write_pin

self._bus.write_byte_data(self.address, self.GPIOB, self.portbval)
IOError: [Errno 5] Input/output error

I made clean installation for rasbrain jessi. swap code between python2 and python3 and same error occure after few cycles
the code I am using is :
from ABE_helpers import ABEHelpersfrom ABE_IoPi import IoPiimport timeimport re
import ndata # place where I put lists of data
mDelay = 0.01
i2c_helper = ABEHelpers() # I use single instanse and 3 instanse and problem remain i2c_bus = i2c_helper.get_smbus()i2c_bus1 = i2c_helper.get_smbus()i2c_bus2 = i2c_helper.get_smbus()
#based on jumpers selection
bus = IoPi(i2c_bus, 0x20)bus1= IoPi(i2c_bus1, 0x21)bus2= IoPi(i2c_bus2, 0x23)
def setup_ports_dir(): bus.set_port_direction(0, 0x00) bus.set_port_direction(1, 0x00) bus1.set_port_direction(0, 0x00) bus1.set_port_direction(1, 0x00) bus2.set_port_direction(0, 0x00) bus2.set_port_direction(1, 0x00)
def rest_ports(): bus.write_port(0, 0xff) bus.write_port(1, 0xff) bus1.write_port(0, 0xff) bus1.write_port(1, 0xff) bus2.write_port(0, 0xff) bus2.write_port(1, 0xff)
def send_2_relays(row):
bus.write_pin(1, int(row[0])) # till row[47]

while True:
for row in ndata.mlist: send_2_relays(row) time.sleep(mDelay)


Posted by:

andrew Avatar

United Kingdom

andrew Twitter  andrew Website  


I see in your comments that you have tried a single instance and 3 instances of the i2c_helper but have you tried using a single instance of i2c_bus? Having three instances of the i2c bus could be causing the problem if one instance hasn't closed properly before the next one is accessed. You should be able to initialise all three IoPi instances with a single i2c_bus object.

bus = IoPi(i2c_bus, 0x20)
bus1= IoPi(i2c_bus, 0x21)
bus2= IoPi(i2c_bus, 0x23)


Posted by:

amer.rubyie Avatar

Hi, Thank you for replay, I will make test tomorrow and replay, thank you again for your comment.

Sign in to post your reply

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.