rm-hull / luma.oled

Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED
https://luma-oled.readthedocs.io
MIT License
790 stars 162 forks source link

Input/output error for luma.oled #372

Open lmcpith opened 1 year ago

lmcpith commented 1 year ago

Type of Raspberry Pi

Linux Kernel version

5.4.0-139-generic

kindly suggest a version of luma that can work with linux ubuntu. might be timing or handhake. using oled 128x32

Expected behaviour

trying to use luma.oled library under linux ubuntu oled is well detected and well mapped under i2c but and mapped as 0x3c, visible hoping to use this library under linux ubuntu 18

Actual behaviour

    device = ssd1306(serial)
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/oled/device.py", line 171, in __init__
    self.clear()
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/core/mixin.py", line 46, in clear
    self.display(Image.new(self.mode, self.size))
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/oled/device.py", line 200, in display
    self.data(list(buf))
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/core/device.py", line 55, in data
    self._serial_interface.data(data)
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/core/interface/serial.py", line 131, in data
    write(list(data[i:i + block_size]))
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/luma/core/interface/serial.py", line 140, in _write_large_block
    self._bus.i2c_rdwr(self._i2c_msg_write(self._addr, [self._data_mode] + data))
  File "/home/letmein/miniconda3/lib/python3.9/site-packages/smbus2/smbus2.py", line 658, in i2c_rdwr
    ioctl(self.fd, I2C_RDWR, ioctl_data)
OSError: [Errno 5] Input/output error
thijstriemstra commented 1 year ago

what device are you using? can you link the datasheet or seller link?

lmcpith commented 1 year ago

HIbranded from china probably, part number is cm009605v4it works with arduino, I was retesting with Linux ubuntu

ve2opn commented 11 months ago

Identical behaviour on latest Fedora Linux/x86_64 6.3.11-200.fc38.x86_64 Kernel and 2.42" ssd1309 i2c 128x64 module from here : https://www.aliexpress.com/item/1005003091769556.html I needed to short D2 as explained to get it visible at 0x3c.
The same example (terminal.py) works fine with two other smaller i2c modules based sh1106 and ssd1306 chips. However with this one, starts and fails after a second-two working. Typically: ... i2c_rdwr ioctl(self.fd, I2C_RDWR, ioctl_data) OSError: [Errno 5] Input/output error

FYI, the module as HW on same host works well with this driver: https://github.com/armlabs/ssd1306_linux

ve2opn commented 11 months ago

Actual behaviour

[root@fedora examples]# python terminal.py -d ssd1309 --i2c-port 0
Version: luma.oled 3.12.0 (luma.core 2.4.0)
Display: ssd1309
Interface: i2c
Dimensions: 128 x 64
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/msh1/TEST/luma.examples/examples/terminal.py", line 82, in <module>
    main()
  File "/home/msh1/TEST/luma.examples/examples/terminal.py", line 31, in main
    term.println("Uses any font to output text using a number of different print methods.")
  File "/usr/local/lib/python3.11/site-packages/luma/core/virtual.py", line 288, in println
    self.puts(text)
  File "/usr/local/lib/python3.11/site-packages/luma/core/virtual.py", line 304, in puts
    method(*args)
  File "/usr/local/lib/python3.11/site-packages/luma/core/virtual.py", line 339, in putch
    self.flush()
  File "/usr/local/lib/python3.11/site-packages/luma/core/virtual.py", line 402, in flush
    self._device.display(self._backing_image)
  File "/usr/local/lib/python3.11/site-packages/luma/oled/device/__init__.py", line 310, in display
    self.data(list(buf))
  File "/usr/local/lib/python3.11/site-packages/luma/core/device.py", line 55, in data
    self._serial_interface.data(data)
  File "/usr/local/lib/python3.11/site-packages/luma/core/interface/serial.py", line 131, in data
    write(list(data[i:i + block_size]))
  File "/usr/local/lib/python3.11/site-packages/luma/core/interface/serial.py", line 140, in _write_large_block
    self._bus.i2c_rdwr(self._i2c_msg_write(self._addr, [self._data_mode] + data))
  File "/usr/local/lib/python3.11/site-packages/smbus2/smbus2.py", line 658, in i2c_rdwr
    ioctl(self.fd, I2C_RDWR, ioctl_data)
OSError: [Errno 5] Input/output error
[root@fedora examples]#
thijstriemstra commented 9 months ago

I was retesting with Linux ubuntu latest Fedora Linux/x86_64 6.3.11-200.fc38.x86_64 Kernel

Anyone can test this on Raspberry Pi OS? I don't have such a device so won't be able to test..

harshamsh commented 1 month ago

Any updates on this issue? having similar problems with ssd1309 on rpi4