Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4484

Interfacing (DSI, CSI, I2C, etc.) • Waveshare 4inch SPI Display on RPi5

$
0
0
Hello everyone

Does anyone here have the Waveshare 4inch SPI Display (SKU: 10207) running on the RPi5 and was able to communicate with the display via python script? So far, I'm completely failing.

I've connected the Display via GPIO Header and downloaded the drivers from Waveshare, found here:
https://github.com/waveshare/LCD-show.git

Then I've done:

Code:

chmod +x LCD4-show ./LCD4-show 
..as stated in the Wiki (https://www.waveshare.com/wiki/4inch_RPi_LCD_(A)).

When I run this example code, I get the following errors:

Code:

import timeimport busioimport digitaliofrom board import SCK, MOSI, MISO, D2, D3from adafruit_rgb_display import color565import adafruit_rgb_display.ili9341 as ili9341# Configuration for CS and DC pins:CS_PIN = D2DC_PIN = D3# Setup SPI bus using hardware SPI:spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)# Create the ILI9341 display:display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),                          dc=digitalio.DigitalInOut(DC_PIN))# Main loop:while True:    # Clear the display    display.fill(0)    # Draw a red pixel in the center.    display.pixel(120, 160, color565(255, 0, 0))    # Pause 2 seconds.    time.sleep(2)    # Clear the screen blue.    display.fill(color565(0, 0, 255))    # Pause 2 seconds.    time.sleep(2)
Output:

Code:

File "/test/spi2.py", line 18, in <module>    display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/pi/venvpp/lib/python3.11/site-packages/digitalio.py", line 197, in __init__    self.direction = Direction.INPUT    ^^^^^^^^^^^^^^  File "/home/pi/venvpp/lib/python3.11/site-packages/digitalio.py", line 227, in direction    self._pin.init(mode=Pin.IN)  File "/home/pi/venvpp/lib/python3.11/site-packages/adafruit_blinka/microcontroller/bcm283x/pin.py", line 40, in init    GPIO.setup(self.id, GPIO.IN)    RuntimeError: Cannot determine SOC peripheral base address    
I've read, that it might be related to the new RPi5 Hardware and to changes how to use GPIO, but I'm missing a hint, where to start. Any ideas?

Statistics: Posted by Tetrikus — Fri Nov 22, 2024 8:04 am — Replies 5 — Views 57



Viewing all articles
Browse latest Browse all 4484

Trending Articles