wecodewithmichaelmccloskey / Smart_Breadboard

MIT License
1 stars 0 forks source link

Test Liveness of Touchscreen #22

Closed wecodewithmichaelmccloskey closed 1 year ago

wecodewithmichaelmccloskey commented 1 year ago

(1 hour)

wecodewithmichaelmccloskey commented 1 year ago

When the display is powered on, with no instructions, it simply shows a blank white screen:

Image

wecodewithmichaelmccloskey commented 1 year ago

Attempted to use the Adafruit CircuitPython RGB Display module. However, when I try to run the example file I get the error OSError: /dev/spidev0.0 does not exist

I also cannot find the spidev module when I run the lsmod | grep spi even after enabling SPI using raspi-config and rebooting.

To solve this issue, I attempted to download spidev using sudo apt install python3-spidev which returns python3-spidev is already the newest version (20200602~200721-1). I also used pip3 install spidev which returns Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (3.5) Neither resolved the issue.

I attempted to get spidev from github using the following commands: git clone https://github.com/doceme/py-spidev.git cd py-spidev make sudo make install (which also required me to use sudo apt-get install python3-setuptools to be able to make) This also did not resolve the issue.

I will be going into office hours on Wednesday, Thursday, and Friday to try to get SPI and the Adafruit CircuitPython RGB Display module working so that I can confirm the functionality of the display.

ffund commented 1 year ago

Attempted to use the Adafruit CircuitPython RGB Display module. However, when I try to run the example file I get the error OSError: /dev/spidev0.0 does not exist

I also cannot find the spidev module when I run the lsmod | grep spi even after enabling SPI using raspi-config and rebooting.

Since the error message indicates that the OS cannot find the SPI device, it's possible that the SPI peripheral on your Pi is broken. (For example, if you accidentally connected it to a 5V SPI bus, or if there is a soldering problem on the display header that causes a short.)

My recommendation is to first validate if this is the case:

If it raises the same error: it's probably an OS/driver/configuration problem.. If it does not raise the error about finding the SPI 0,0 device: it's probably your Pi.

If it turns out that SPI0 on your Pi is broken, you can put your SD card back into your own Pi, and try SPI1 to see if it works. You can enable SPI1 by adding a line to the boot config file, then rebooting the Pi, as described here.

After rebooting, check in /dev and check the output of lsmod to see if the SPI device is recognized.

If SPI1 is also not recognized, there might be more damage to the Pi than we can overcome by working around it - then we'd probably have to swap out the Pi.

Regardless: before trying to connect the display again, you should make sure you are not connecting it in a way that can damage the SPI bus it is connected to.

To solve this issue, I attempted to download spidev using sudo apt install python3-spidev which returns python3-spidev is already the newest version (20200602~200721-1). I also used pip3 install spidev which returns Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (3.5) Neither resolved the issue.

I attempted to get spidev from github using the following commands: git clone https://github.com/doceme/py-spidev.git cd py-spidev make sudo make install (which also required me to use sudo apt-get install python3-setuptools to be able to make) This also did not resolve the issue.

There is no indication that the Python library is the problem - if the driver is not even loaded and the SPI0 device does not appear in /dev, that's several steps below the Python library.

wecodewithmichaelmccloskey commented 1 year ago

After placing my sd card into Fatiha's Pi, the same error still occurred.

wecodewithmichaelmccloskey commented 1 year ago

pi@raspberrypi23:~ $ ls /dev autofs dma_heap input loop7 mqueue ram12 ram8 spidev1.1 tty12 tty21 tty30 tty4 tty49 tty58 ttyAMA0 vcs1 vcsa4 vcsu6 video20 block dri kmsg loop-control net ram13 ram9 spidev1.2 tty13 tty22 tty31 tty40 tty5 tty59 ttyprintk vcs2 vcsa5 vhci video21 btrfs-control fd log mapper null ram14 random stderr tty14 tty23 tty32 tty41 tty50 tty6 uhid vcs3 vcsa6 video10 video22 bus full loop0 media0 ppp ram15 rfkill stdin tty15 tty24 tty33 tty42 tty51 tty60 uinput vcs4 vcsm-cma video11 video23 cachefiles fuse loop1 media1 ptmx ram2 serial1 stdout tty16 tty25 tty34 tty43 tty52 tty61 urandom vcs5 vcsu video12 video31 cec0 gpiochip0 loop2 media2 pts ram3 shm tty tty17 tty26 tty35 tty44 tty53 tty62 v4l vcs6 vcsu1 video13 watchdog char gpiomem loop3 mem ram0 ram4 snd tty0 tty18 tty27 tty36 tty45 tty54 tty63 vchiq vcsa vcsu2 video14 watchdog0 console hwrng loop4 mmcblk0 ram1 ram5 spidev0.0 tty1 tty19 tty28 tty37 tty46 tty55 tty7 vcio vcsa1 vcsu3 video15 zero cuse i2c-2 loop5 mmcblk0p1 ram10 ram6 spidev0.1 tty10 tty2 tty29 tty38 tty47 tty56 tty8 vc-mem vcsa2 vcsu4 video16 disk initctl loop6 mmcblk0p2 ram11 ram7 spidev1.0 tty11 tty20 tty3 tty39 tty48 tty57 tty9 vcs vcsa3 vcsu5 video18 pi@raspberrypi23:~ $ tail --lines=10 /boot/config.txt

--- added by adafruit-pitft-helper Tue Feb 14 23:34:20 2023 ---

[all] hdmi_force_hotplug=0 dtparam=spi=on dtparam=i2c1=on dtparam=i2c_arm=off

dtoverlay=pitft35-resistive,rotate=90,speed=20000000,fps=20

--- end adafruit-pitft-helper Tue Feb 14 23:34:20 2023 ---

dtoverlay=spi1-3cs

It seems that the line dtoverlay=pitft35-resistive,rotate=90,speed=20000000,fps=20 conflicted with using spidev, as after commenting out that line in the config, the module showed back up.

wecodewithmichaelmccloskey commented 1 year ago

Using the Adafruit CircuitPython RGB Display module now I get the error

pi@raspberrypi23:~/touchscreen $ python3 display_image.py
Traceback (most recent call last):
  File "/home/pi/touchscreen/display_image.py", line 89, in <module>
    image = image.resize((scaled_width, scaled_height), Image.Resampling.BICUBIC)
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 62, in __getattr__
    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'PIL.Image' has no attribute 'Resampling'

The output on the display looks like this:

Image

wecodewithmichaelmccloskey commented 1 year ago

I was successfully able to test the liveness of the touchscreen by running two example files. The output of the first example file:

Image

The output of the second example file:

Image

wecodewithmichaelmccloskey commented 1 year ago

@creechelseaa please review