I'm going to use I2C for Arduino-Raspberry Pi 4 communications, I'm trying to change I2C pins because I need the initial I2C pins (GPIO3 and GPIO4) for other purpose.
I'm using Ubuntu 21.04, and I'm trying this changing config.txt and I'm using SMBUS2.
Here it is my config.txt i2c configuration:
dtparam=audio=on dtparam=i2c_arm=on dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24 dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=17,i2c_gpio_scl=27 dtparam=spi=on My output applying i2cdetect 3 bus using address 31 (with I2C lines located on GPIO17 and GPIO27), is this (is detected correctly):
sudo i2cdetect -y 3 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1f 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- But the output code when I execute one smbus2 library test returns an error:
File "/usr/lib/python3/dist-packages/smbus2/smbus2.py", line 643, in write_i2c_block_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error If I connect the I2C lines on GPIO2 and GPIO3 it works.
I'm using a level shifter between Arduino and Raspberry, and 10k pull up resistors to 5V.