Tutorial MCP23017 verses PCA9535
The IO Pi Plus is a 32 channel MCP23017 GPIO expander for the Raspberry Pi
10/08/2022
Posted by:
inobu
In the tutorial I was getting this error
Traceback (most recent call last):
File "/home/pi/led.py", line 5, in <module>
bus = IOPi(0x21)
File "/usr/local/lib/python3.9/dist-packages/IOPi/IOPi.py", line 117, in __init__
self.__bus.write_byte_data(self.__ioaddress, self.IOCON, self.__conf)
File "/usr/local/lib/python3.9/dist-packages/smbus2/smbus2.py", line 455, in write_byte_data
ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error
Trying to see what was wrong I noticed the IOPi is written for the MCP23017. Pulling up the
datasheet for the current IO PiZero PCA9535 the command structure is different. Is the IO32
tutorial valid?
Inobu
Traceback (most recent call last):
File "/home/pi/led.py", line 5, in <module>
bus = IOPi(0x21)
File "/usr/local/lib/python3.9/dist-packages/IOPi/IOPi.py", line 117, in __init__
self.__bus.write_byte_data(self.__ioaddress, self.IOCON, self.__conf)
File "/usr/local/lib/python3.9/dist-packages/smbus2/smbus2.py", line 455, in write_byte_data
ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error
Trying to see what was wrong I noticed the IOPi is written for the MCP23017. Pulling up the
datasheet for the current IO PiZero PCA9535 the command structure is different. Is the IO32
tutorial valid?
Inobu
11/08/2022
Posted by:
inobu
102:~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
11/08/2022
Posted by:
inobu
ok, I found the problem. I was linked to the old tutorial
I should have been here.
https://www.abelectronics.co.uk/kb/article/1099/io-zero-32-tutorial-1---the-blinking-led
Inobu
I should have been here.
https://www.abelectronics.co.uk/kb/article/1099/io-zero-32-tutorial-1---the-blinking-led
Inobu
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.