Hi,
I am trying to create a digital clock using a Raspberry Pi 400, SparkFun pHat extension (https://www.sparkfun.com/products/17512), an Adafruit JST SH 4-Pin Qwiic compatible cable (10cm), and SparkFun 20x4 SerLCD (https://www.sparkfun.com/products/16398).
The SerLCD is directly connected via the Qwiic cable to the pHAT extension. And the pHAT extension is plugged into the Raspberry Pi 400. There are no other cables or extensions between the components.
I2C is enabled on my system, and I can see the SerLCD with
$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- 72 -- -- -- -- --
But writing to SerLCD fails after a few seconds/writes with:
OSError: [Errno 121] Remote I/O error
I tried different libraries (including your Qwiic Raspberry Pi Python library), but I always get this error.
Similar code runs fine on my Raspberry Pi Pico. Also, other I2C devices work like Sense HAT 1.0 mounted on the Qwiic pHAT.
Also, I connected the SerLCD with short jumper cables directly to the GPIO pins 2,3, GND and +3.3V without any luck.
The only way to make it work was using software I2C by adding
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=5,i2c_gpio_scl=6
to /boot/config.txt
And using the GPIO pins 5 and 6. Then it works flawless.
This is the shortest piece of code that always fails with the Qwiic connection:
import smbus
i2c = smbus.SMBus(1)
i2c.write_byte(114, 0x7C)
i2c.write_byte(114, 0x2D)
i2c.write_byte(114, 0x7C)
i2c.write_byte(114, 0x18)
i2c.write_byte(114, 150)
The code fails randomly on the second, third, or fourth write.
Is there a way to make the SerLCD work using the Qwiic connectors?
System details:
SerLCD 20x4:
OpenLCD 1.4
Raspberry Pi 400:
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux
config.txt:
dtparam=i2c_arm=on
dtparam=spi=on
software I2C bus
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=5,i2c_gpio_scl=6
Thank you very much and best regards,
Josef