NanoPi M4v2 + OPi.GPIO + Luma.OLED + SSD1351 Error
TCB13 opened this issue · 1 comments
Hello,
I'm sure this library works just fine but I'm missing some piece here. I'm trying to drive an SSD1351 LCD with OPi.GPIO + Luma.OLED however I'm not having much luck. Here is what I did:
- Install Luma.OLED:
apt-get update
apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 libtiff5 -y
pip3 install luma.oled
- Install OPi.GPIO:
pip3 install --upgrade OPi.GPIO
- Wire my LCD as:
MOSI > GPIO1_A7 > SPI1_RXD > M4 Pin 21 > LCD DIN Pin (blue)
SCK > GPIO1_B1 > SPI1_CLK > M4 Pin 23 > LCD CLK Pin (yellow)
CS > GPIO1_B2 > SPI1_CSn0 > M4 Pin 24 > LCD CS Pin (orange)
RST > GPIO1_A1(3V) > M4 Pin 11 > LCD RST Pin (white)
DC > GPIO1_A3(3V) > M4 Pin 13 > LCD DC Pin (green)
- Find the spidev and run a Luma.OLED example as:
ls /dev/spi*
/dev/spidev1.0
python3 luma.examples/examples/3d_box.py
--display=ssd1351
--interface=spi
--width=128 --height=128
--spi-bus-speed=16000000
--bgr
--spi-device=1 --spi-port=0
--gpio-reset=35
--gpio-data-command=33
--gpio=OPi.GPIO
--gpio-mode=nanopi.m4.BOARD
From what I understand of https://github.com/rm-hull/OPi.GPIO/blob/master/nanopi/m4.py my physical pin 11 maps to GPIO 33 and physical pin 13 to GPIO 35. Is this even correct?
Now it fails with the following output:
Traceback (most recent call last):
File "luma.examples/examples/3d_box.py", line 129, in <module>
device = get_device()
File "/root/luma.examples/examples/demo_opts.py", line 61, in get_device
device = cmdline.create_device(args)
File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 246, in create_device
device = Device(serial_interface=interface(), **params)
File "/usr/local/lib/python3.7/dist-packages/luma/core/cmdline.py", line 161, in spi
gpio=self.gpio or GPIO)
File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 299, in __init__
bitbang.__init__(self, gpio, transfer_size, reset_hold_time, reset_release_time, DC=gpio_DC, RST=gpio_RST)
File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 187, in __init__
self._DC = self._configure(kwargs.get("DC"))
File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 200, in _configure
self._gpio.setup(pin, self._gpio.OUT)
File "/usr/local/lib/python3.7/dist-packages/OPi/GPIO.py", line 470, in setup
pin = get_gpio_pin(_mode, channel)
File "/usr/local/lib/python3.7/dist-packages/OPi/pin_mappings.py", line 80, in get_gpio_pin
return _pin_map[mode][channel]
KeyError: 33
SBC: NanoPi M4V2
System: Armbian 5.10.35-rockchip64 #21.05.1 SMP PREEMPT Fri May 7 13:53:11 UTC 2021 aarch64 GNU/Linux
Display: https://www.ebay.com/itm/203101646517
Datasheet: https://www.waveshare.com/w/upload/5/5b/1.5inch_RGB_OLED_Module_User_Manual_EN.pdf
Thank you.
My mistake, fixed at rm-hull/luma.oled#331 (comment) and rm-hull/luma.oled#331 (comment)
Thank you all.