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?

roger-reject
  • 133
  • 6

2 Answers2

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).

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
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!

roger-reject
  • 133
  • 6