Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgb_display_ili9341test.py fails #123

Open
ojoojoo opened this issue Mar 3, 2024 · 2 comments
Open

rgb_display_ili9341test.py fails #123

ojoojoo opened this issue Mar 3, 2024 · 2 comments

Comments

@ojoojoo
Copy link

ojoojoo commented Mar 3, 2024

administrator@raspberrypi:~ $ python3 rgb_display_ili9341test.py
Traceback (most recent call last):
File "/home/administrator/rgb_display_ili9341test.py", line 25, in
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 365, in init
self._spi = _SPI(portId)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 25, in init
self._spi = spi.SPI(device=(portid, 0))
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/spi.py", line 149, in init
raise IOError(f"{device} does not exist")
OSError: /dev/spidev0.0 does not exist

Whats wrong here?

@makermelissa
Copy link
Contributor

Without knowing the specifics of your setup, it's most likely one of:

  • SPI not enabled
  • Kernel Driver is in use

@ojoojoo
Copy link
Author

ojoojoo commented Mar 5, 2024

Sometimes things are that easy...

But it's still not working, still a white screen and now I don't get any error at all, it's just this:

administrator@raspberrypi:~ $ python3 rgb_display_ili9341test.py

And than nothing.... no red or blue pixel, only white.

This is the script I'm using:

SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries

SPDX-License-Identifier: MIT

Quick test of TFT FeatherWing (ILI9341) with Feather M0 or M4

Will fill the TFT black and put a red pixel in the center, wait 2 seconds,

then fill the screen blue (with no pixel), wait 2 seconds, and repeat.

import time
import random
import busio
import digitalio
import board

from adafruit_rgb_display.rgb import color565
from adafruit_rgb_display import ili9341

Configuratoin for CS and DC pins (these are FeatherWing defaults on M0/M4):

cs_pin = digitalio.DigitalInOut(board.D9)
dc_pin = digitalio.DigitalInOut(board.D10)

Config for display baudrate (default max is 24mhz):

BAUDRATE = 24000000

Setup SPI bus using hardware SPI:

spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)

Create the ILI9341 display:

display = ili9341.ILI9341(spi, cs=cs_pin, dc=dc_pin, baudrate=BAUDRATE)

Main loop:

while True:
# Fill the screen red, green, blue, then black:
for color in ((255, 0, 0), (0, 255, 0), (0, 0, 255)):
display.fill(color565(color))
# Clear the display
display.fill(0)
# Draw a red pixel in the center.
display.pixel(display.width // 2, display.height // 2, color565(255, 0, 0))
# Pause 2 seconds.
time.sleep(2)
# Clear the screen a random color

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants