adafruit / Raspberry-Pi-Installer-Scripts

380 stars 158 forks source link

Get PiTFT working on Raspberry Pi OS Bookworm Desktop Version #268

Closed makermelissa closed 7 months ago

makermelissa commented 11 months ago

So it appears they have finally removed the FKMS driver(https://github.com/raspberrypi/documentation/issues/2948) which I believe is the only way the fbcp utility was working. My understanding is there is now a generic MIPI driver that is the correct way to go with fixing this. I had previously done some work towards this in https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/main/adafruit-pitft-mipi.py, but the script is a little out of date. The next step may be to combine the pitft and the mipi scripts, but I will consult if this is correct.

kevinkahn commented 9 months ago

FYI: I used your current mipi version installer to install a 3.5r screen more or less successfully on Bookworm Desktop version booting to a cli only. One script bug - you need to add boot_dir to the global statement in the main proc. The main issue that I encountered is that the touch coordinates seem reversed relative to the screen rotation. My purpose in doing the install is to run a personal app that uses the entire screen from pygame so I can compensate for that reversal in my code for the moment but if you know how to actually flip the coordinates for touch with the mipi drivers that would help me out.

makermelissa commented 9 months ago

Thanks. It sounds like you got further than I did when testing.

graemeok commented 9 months ago

worked for me with Bookworm Desktop after changing the display to X. raspi-config -> Advanced Options -> Wayland -> X11

unfortunately, this disabled my hdmi output and there is no --uninstall option, so I had re-image and start again I want to be able to use the adafruit-circuitpython-rgb-display python module, it crashes because libgpiod_pin:line 98 reports that the pin is busy.

makermelissa commented 9 months ago

That's not ideal, but it is something. Thanks for the input.

kevinkahn commented 9 months ago

It seems that unlike with X, Wayland grabs some sort of exclusive access on the display system. In the older versions, I could allow X to bring a desktop up on the screen and then pygame would grab it anyway. Now that doesn't happen. Thus if you want to access the display directly, as I do via Pygame to the physical screen, you need to not allow Wayland to start up on the screen. I think that is why you see things work with the Lite version or I see it work if I tell the desktop system to boot to only a command line. If I don't do that I get an error that the driver (kmsdrm) isn't available. Don't know if any of that helps anyone but it is what I have noted. My application seems fine now that I don't hand that screen to Wayland at boot.

makermelissa commented 8 months ago

I have it working in wayland using the mipi-panel-driver. There was an issue where the script was commenting out the kms driver, which I just fixed in #288. Still experimenting with the right combination of things.

For 2.8" capacitive driver, I needed to add dtparam=touch-swapxy,touch-invy, but it still seems to use the full desktop width if an HDMI monitor is connected.

Wayland supports scaling and typing wlr-randr --output SPI-1 --scale 0.75 into the command line in a window on the desktop will make shrink things so more fits on the screen. I believe there's a way to edit ~/.config/wayfire.ini to add scaling on boot up.

Styne13 commented 7 months ago

Hi,

thank you for the nice project and your mainainance work!

Can you please describe the steps you did to get it running on the desktop version again?

I use a 2.4 resistive touch panel with bookworm aarch64 on a raspberry pi 3 and followed the easy-install guide you mentioned in #264. Instead of executing the adafruit-pitft.py I used the adafruit-pitft-mipi.py like this: sudo -E env PATH=$PATH python3 adafruit-pitft-mipi.py --display=28r --rotation=90

After the reboot, the backlight is on, but the screen stays black.

Can I help with additional debug information?

BR Marcel

makermelissa commented 7 months ago

Fixed by #293.

makermelissa commented 7 months ago

@Styne13 please try again. It was just updated with new overlays and should now work.

Styne13 commented 7 months ago

Hi @makermelissa, it seems loginctl won't return wayland session on my freshly installed bookworm, but I think this is the default now. After the installation, my display didn't show anything. (Used the adafruit-pitft.py this time, because you merged the files in your last change).

Experimental changed the is_wayland function to always return "wayland" and at the beginning I can see plymouth boot screen, but won't get to a desktop session afterwards and it stays black. Installing with --install-type=console that way is working fine.

Maybe I can also help to investigate further.

makermelissa commented 7 months ago

@Styne13 I'll need to take another look. For now, to get it working, you can edit /boot/firmware/config.txt and find the dtoverlay line and at the end add ,drm

makermelissa commented 7 months ago

@Styne13 I forgot to ask. Which hardware are you on? I was testing with the Pi 5, but it may just be a hardware difference I didn't test for causing the issue.

makermelissa commented 7 months ago

Also, it would be helpful to know which specific version of Bookworm you wrote to the SD card (i.e. Desktop vs Lite, 32 vs 64 bit, etc.)

Styne13 commented 7 months ago

Ok, I will try with the drm overlay.

I used a raspberry pi 3 with 64bit desktop, but can also test on all other pi except 5th.

makermelissa commented 7 months ago

Thanks, I'll give it the Pi 3 a try.

Styne13 commented 7 months ago

@Styne13 I'll need to take another look. For now, to get it working, you can edit /boot/firmware/config.txt and find the dtoverlay line and at the end add ,drm

Thanks, the drm option did the trick. :) Afterwards I navigate into Preferences->Screen Configuration->Layout->Screens on the Pi and enabled the second screen there to get an output. Maybe this shall also be mentioned in the Easy Install Tutorial.