2

I have the following 128 x 128 OLED display: http://www.lcdwiki.com/zh/1.5inch_OLED_Module_SKU:MC01503 which is driven by a SSD1327 module.

I'm trying to use this with a Pi 4 and the Luma.oled python repository of rm-hull, which supports SSD1327: https://github.com/rm-hull/luma.oled

The installation of the libraries was carried out according the the instructions here: https://github.com/rm-hull/luma.examples

everything installed with no problems. However, whenever I try to use any examples, or run the library from my own code, it always throws an error that it can't find the OLED display. The traceback is as follows:

File "/usr/local/lib/python3.7/dist-packages/smbus2/smbus2.py", line 622, in write_i2c_block_data ioctl(self.fd, I2C_SMBUS, msg)

OSError: [Errno 121] Remote I/O error

However, running i2cdetect shows the device exactly where expected.

error from luma.example, plus output of i2cdetect

I have previously successfully communicated with an ADS1115 ADC converter using I2C from this same Pi, so it shouldn't be a problem with the pins or the Pi itself.

Does anyone have any experience with running this display who could shed some light on why i2cdetect can see the chip, but the python library can't?

14
  • I usually "pip install" a python library/package and then find python3 could not find the package. My lesson learnt is that if I am going to use python 3, I must used "pip3 install", otherwise python 3 cannot find the package which is installed in the default python 2 directories. Perhaps you might also that some sort of python2/3 compatibility problems.
    – tlfong01
    Commented Jul 13, 2020 at 2:58
  • 1
    But your problem seems to be I/O related. You can find your LED at 0x3c does NOT guarantee you can write to it. Perhaps you can lower you I2C speed from standard 100kHz down to 50kHz, or even 10kHz, to see if problem disappeared. Other troubleshooting tricks include: (1) Use short wires, say less than 30cm, (2) remove all SMD 4k7/10k pullups from I2C modules. This helps reducing total equivalent pullups impedance exceeding the I2C's 400pF limit (Rpi4 I2C pins already have strong 1k8 pullups, too many external pullup might make pullup too strong for I2C pin to handle at high speed.
    – tlfong01
    Commented Jul 13, 2020 at 3:06
  • 1
    thanks for the suggestions! The wires are already short (~10cm), and there's no external pullups. I'll try lowering the i2c speed and see what happens. Commented Jul 13, 2020 at 4:29
  • Almost a year ago I did successfully tested displayed "Hello World" in a OLED. You might like to check if my writeup helps: "Rpi3B SSD1306 OLED I2C Interface Problem - 2019dec21": raspberrypi.stackexchange.com/questions/106482/….
    – tlfong01
    Commented Jul 13, 2020 at 5:11
  • I vaguely remember I used the following python Library to test the Hello World python program. indibit.de/…. But I forgot all the details, or actually not much details. I just loaded the library and ran the demo program. One thing to remind is that if your OLED module has an built in 3-leg LDO, then you should power it with 5V. The module might still work with 3V3 power, but might not be that stable.
    – tlfong01
    Commented Jul 13, 2020 at 5:19

2 Answers 2

1

Errno 121 means (besides using a wrong address, which is not your case) that the slave didn't expect the command you have sent and didn't acknowledge it properly. This often happens if the master transmits extra bytes or not enough bytes by mistake.

The easiest way to debug this would be to connect a logic analyzer or a scope capable of I2C decoding to the bus and looking at the actual bytes your code transmits, and an eventual response from the slave. You could then directly compare that to the datasheet or a capture made on a working system (e.g. Arduino).

1

I believe Dmitry's answer is correct and there is something in the I2C communication that's going wrong. However, since I'm still waiting for access to a logic analyzer, I took the easier and cheaper route of simply buying a second screen with SPI wiring. That one works flawlessly out of the box.

Thus another "answer" is to avoid purchasing OLED boards with only I2C wiring options!

1
  • Thanks for reporting back. I'm sure this will help people who are not going to debug non-working communication anyway. Commented Jul 20, 2020 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.