goodtft / LCD-show

2.4" 2.8"3.2" 3.5" 5.0" 7.0" TFT LCD driver for the Raspberry PI 3B+/A/A+/B/B+/PI2/ PI3/ZERO/ZERO W
2.28k stars 783 forks source link

Require TFT 3.5 display configuration for Raspberry Pi Bookworm release #369

Open ruthvikb14 opened 4 months ago

ruthvikb14 commented 4 months ago

Hi,

I'm raising this issue to request help in installing the TFT3.5 display to Pi 3B+ with Bookworm OS. The current LCD35-show.sh will not work since it is configured to Bullseye and the the new version of Bookworm is > 12.1. And also there are few changes in Bookworm OS like config.txt is shifted from "/boot" to "/boot/firmware" etc. So it is much appreciated if you can include the changes to LCD-show repo to support Bookworm OS

maxpaine69 commented 4 months ago

having the same problem. If i use bullseyes no problems everything perfect, upgrading or new install to Bookworm doesnt show GUI mantains a black screen, and only in console mode it shows the console.

OldWoman37 commented 4 months ago

You need to switch to X11 from wayland using raspi-config. But you will likely find problems with the touchscreen after.

maxpaine69 commented 4 months ago

You need to switch to X11 from wayland using raspi-config. But you will likely find problems with the touchscreen after.

already tried didnt work

OldWoman37 commented 4 months ago

Do you have the: dtoverlay=tft35a:rotate=90 line in your /boot/firmware/config.txt file? Does your /boot/firmware/overlays folder contain tft35a.dtbo and tft35a-overlay.dtb? After boot, do you have a "fbcp" process running?

maxpaine69 commented 4 months ago

Do you have the: dtoverlay=tft35a:rotate=90 line in your /boot/firmware/config.txt file? Does your /boot/firmware/overlays folder contain tft35a.dtbo and tft35a-overlay.dtb? After boot, do you have a "fbcp" process running?

yes to every thing, i even created a new instaltion

OldWoman37 commented 4 months ago

Oh, this may just be a startup thing. Did you have it run the lightdm login screen before or some autologin thing?

maxpaine69 commented 4 months ago

Oh, this may just be a startup thing. Did you have it run the lightdm login screen before or some autologin thing?

only the autologin on the config, like it as on bullseye,

OldWoman37 commented 4 months ago

Do you have a process "lightdm" or "Xorg" running?

OldWoman37 commented 4 months ago

When running "sudo journalctl -xe", are there services with errors?

maxpaine69 commented 4 months ago

When running "sudo journalctl -xe", are there services with errors?

not to all the question, no error it strange.

OldWoman37 commented 4 months ago

You may just have to re-run raspi-config and select your settings: 1, S5, B3 or B4.

maxpaine69 commented 4 months ago

You may just have to re-run raspi-config and select your settings: 1, S5, B3 or B4.

nothing still the same

OldWoman37 commented 4 months ago

You may need to do: sudo systemctl set-default graphical.target sudo systemctl enable lightdm sudo systemctl start lightdm

maxpaine69 commented 4 months ago

You may need to do: sudo systemctl set-default graphical.target sudo systemctl enable lightdm sudo systemctl start lightdm

nothing still balck screen and blicking

OldWoman37 commented 4 months ago

Can you post the output of: "dmesg | grep fb"

maxpaine69 commented 4 months ago

Can you post the output of: "dmesg | grep fb"

[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=480 bcm2708_fb.fbheight=320 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:22:4E:3A vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 console=ttyS0,115200 console=tty1 root=PARTUUID=9cd26e03-02 rootfstype=ext4 fsck.repair=yes rootwait cfg80211.ieee80211_regdom=PT [ 0.060388] raspberrypi-firmware soc:firmware: Firmware hash is 86ccc427f35fdc604edc511881cdf579df945fb4 [ 1.711704] bcm2708_fb soc:fb: FB found 1 display(s) [ 1.719710] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 480x320 [ 13.915283] fbtft: module is from the staging directory, the quality is unknown, you have been warned. [ 13.951526] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned. [ 13.951951] SPI driver fb_ili9486 has no spi_device_id for ilitek,ili9486 [ 13.952115] fb_ili9486 spi0.0: fbtft_property_value: regwidth = 16 [ 13.952129] fb_ili9486 spi0.0: fbtft_property_value: buswidth = 8 [ 13.952140] fb_ili9486 spi0.0: fbtft_property_value: debug = 0 [ 13.952149] fb_ili9486 spi0.0: fbtft_property_value: rotate = 90 [ 13.952160] fb_ili9486 spi0.0: fbtft_property_value: fps = 30 [ 13.952169] fb_ili9486 spi0.0: fbtft_property_value: txbuflen = 32768 [ 14.531715] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB buffer memory, fps=31, spi0.0 at 16 MHz

here it is

OldWoman37 commented 4 months ago

So, to be clear, you have the console screen working, so you can login via a keyboard in textmode, but now, after that systemctl stuff, the screen is black but flashing/blinking?

maxpaine69 commented 4 months ago

the black screen with the flash is a simtop from the begining, i have the boot to desktop from raspi-config.

OldWoman37 commented 4 months ago

I'm sorry, I don't understand the issue then. Can you post a photo of what you see when booting (if not black but some text mode stuff), and then what you get after?

maxpaine69 commented 4 months ago

I'm sorry, I don't understand the issue then. Can you post a photo of what you see when booting (if not black but some text mode stuff), and then what you get after?

if i configure it to boot to console i see text, no problem there i see the console, but if i configure it to show desktop, it only show a black screen with a blincking cursor

OldWoman37 commented 4 months ago

Okay. If you connect a USB keyboard, and hold down CTRL-ALT, and then press F1, wait a second, press F2, wait a second, press F3, and so on, will cycle through all the virtual terminals. One of them should show you the graphical login.

maxpaine69 commented 4 months ago

Okay. If you connect a USB keyboard, and hold down CTRL-ALT, and then press F1, wait a second, press F2, wait a second, press F3, and so on, will cycle through all the virtual terminals. One of them should show you the graphical login.

no i only see a normal console to login not the desktop login.

OldWoman37 commented 4 months ago

Are the other "screens" (not F1) blank with a flashing cursor?

maxpaine69 commented 4 months ago

Are the other "screens" (not F1) blank with a flashing cursor?

yes only blinking cursor and black screen, even now a cerated a new card with a fresh os.

maxpaine69 commented 4 months ago

it works perfectlly in bullseye, but in bookworm no luck can only use consoel tehre no desktop.

OldWoman37 commented 4 months ago

Let me know the settings you used in the Raspberry Pi Imager, and then the raspi-config options, and I will attempt to replicate the problem here. I think it is just a configuration issue. Later however, you will likely need a new DTB file to make the touch screen work; this is what I had to do.

maxpaine69 commented 4 months ago

Let me know the settings you used in the Raspberry Pi Imager, and then the raspi-config options, and I will attempt to replicate the problem here. I think it is just a configuration issue. Later however, you will likely need a new DTB file to make the touch screen work; this is what I had to do.

hello ther and thanks, in the iamge i already tried all option of bookworm, the configuration are the normal one ssh username and password, the raspi config option e choose x11, and auto desktop login, the most basic options.

maxpaine69 commented 4 months ago

mean while was experimenting and foun out if i alter this dtoverlay=piscreen,drm i star getting image, but strange colors and touch doesnt work.

OldWoman37 commented 4 months ago

Well, I did everything from the beginning. Ran the Pi Imager with Debian Bookworm w/Desktop (recommended). After the first boot, I did:

sudo apt update sudo apt upgrade sudo reboot

sudo raspi-config 6, A6, W1 1, S5, B3 (it automatically reboots)

git clone https://github.com/goodtft/LCD-show.git chmod -R 755 LCD-show cd LCD-show/ sudo ./LCD35-show (it reboots)

And it worked. No issues. It seems the patch from 2 months ago to the tft35a.dtb fixes the touchscreen issue. I thought I grabbed that file, but I didn't; had the old one and fixed it for myself.

maxpaine69 commented 4 months ago

right now i only have a pi0 2w to test i will say something to you when e can getta pi4, i tried on the zero 2w and didnt work, i wil ltry on the pi4, at leat on pi0 2w no go, but its stragne because only happening on bookworm.

ronaldlw commented 4 months ago

Well, I did everything from the beginning. Ran the Pi Imager with Debian Bookworm w/Desktop (recommended). After the first boot, I did:

sudo apt update sudo apt upgrade sudo reboot

sudo raspi-config 6, A6, W1 1, S5, B3 (it automatically reboots)

git clone https://github.com/goodtft/LCD-show.git chmod -R 755 LCD-show cd LCD-show/ sudo ./LCD35-show (it reboots)

And it worked. No issues. It seems the patch from 2 months ago to the tft35a.dtb fixes the touchscreen issue. I thought I grabbed that file, but I didn't; had the old one and fixed it for myself.

I've been trying to get this to work with both a pi zero w and pi 3b with no luck.

right now i'm working with a 3b and followed the steps you gave exactly and just end up with a black screen with blinking cursor in the upper right of the display.

adjei7 commented 4 months ago

I have the same issue with a Pi 5, but think this is already a known issue. I can get it to work perfectly with a pi 3b+ on Bullseye.

adjei7 commented 4 months ago

OK, this is really weird! I finally got it working and think I know why.

If I disconnect the main HDMI screen and reboot, then the 3.5inch screen works. If both are connected, then the 3.5 inch acts as a touch pad for the HDMI screen.

OldWoman37 commented 4 months ago

The installation instructions at: http://www.lcdwiki.com/3.5inch_RPi_Display kind of imply that you shouldn't be connected to a monitor (ie. do the install over SSH). I just assumed that was the case. As I understand it, the way these displays work is by using the internal display controller (GPU), but have it output to a smaller resolution, eg. 480x320. Then, the "fbcp" program constantly copies the internal display to the add-on board's frame buffer over the SPI interconnect. This way you can use the internal GPU to produce 3D scenes. If you connect an HDMI cable, you are basically telling the internal controller to switch back to an HD type resolution and then that screws up the X server at some point and perhaps that is why the add-on display won't switch after.

adjei7 commented 4 months ago

You are right.

Unfortunately, the LCD wiki was only one of the many instruction website that I went to. There was another one that stated (wrongly I guess), that I could either ssh or use a monitor when putting in the instructions. So assumed using monitor was fine. Also, many of the videos, including this one suggested that I would see both images at the same time on both monitors.

But hey, it's all good. Hopefully it's working for @maxpaine69

ronaldlw commented 4 months ago

I'm not connecting a monitor and it still doesn't work for me. @OldWoman37 are there any steps you've left out of your process that you said got it working for Debian Bookworm w/Desktop ? What pi is this, i'm using a 3b and have also tried with zero w

maxpaine69 commented 4 months ago

i already tested no problems to show on pi 4, but im starting to see that pi ist getting away from older version, tryed on a 3 and pi zero 2 w only works until bulleyes, bookworm no luck on both pi zero 2w and pi3.

adjei7 commented 4 months ago

i already tested no problems to show on pi 4, but im starting to see that pi ist getting away from older version, tryed on a 3 and pi zero 2 w only works until bulleyes, bookworm no luck on both pi zero 2w and pi3.

I will test it out on my pi 3 and let you know.

OldWoman37 commented 4 months ago

I'm not connecting a monitor and it still doesn't work for me. @OldWoman37 are there any steps you've left out of your process that you said got it working for Debian Bookworm w/Desktop ? What pi is this, i'm using a 3b and have also tried with zero w

I did it on a Pi 4, and I recorded everything I did. But since the distro is the same for 3s and 0s, I don't see why it shouldn't be any different for those.

ronaldlw commented 3 months ago

I'm not connecting a monitor and it still doesn't work for me. @OldWoman37 are there any steps you've left out of your process that you said got it working for Debian Bookworm w/Desktop ? What pi is this, i'm using a 3b and have also tried with zero w

I did it on a Pi 4, and I recorded everything I did. But since the distro is the same for 3s and 0s, I don't see why it shouldn't be any different for those.

Well, I can verify it does work for pi 4 but not 3 or zero

adjei7 commented 3 months ago

i already tested no problems to show on pi 4, but im starting to see that pi ist getting away from older version, tryed on a 3 and pi zero 2 w only works until bulleyes, bookworm no luck on both pi zero 2w and pi3.

I will test it out on my pi 3 and let you know.

I can confirm that this process does not work for Pi 3. Just tested it out using the exact same process as the Pi 5.

On the Pi 3, after completing the whole process the screen would go black and show only a blinking cursor. Connecting a keyboard would cause an error message (undervoltage detected) to show (I'll bring this up later). Pressing Alt and scrolling though the function keys would show the different terminals F1 showing the main one, but it would jump right back to the blinking cursor after releasing the keys. So the screen works. But the OS doesn't load properly.

On the Pi 5, after completing the whole process the TFT screen would go black and act as a touch pad for my HDMI screen. When the HDMI screen was disconnected and the pi rebooted, the TFT screen would work perfectly.

Going back to the undervoltage issue, there is a slight chance that the power supply being used could be the cause. I was using a regular microusb cable plug so could only pull about 3amps. It could be a current protection thing which acts differently on different versions of the OS, but have not tested it out.

Either way, I would recommend sticking with Bullseye for Pi 3 and below, as from research there are still a lot of issues with Bookworm.

OldWoman37 commented 3 months ago

Okay. I checked this out on RPi3B+ and I found that a service (glamor-test) was adding a display driver for X. Since X is supposed to use the default driver, this tells it to use a different one, hence the problems you are having. Do the following on a RPi3B+:

sudo systemctl disable glamor-test.service sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf sudo systemctl restart lightdm

Let me know if that works.

ronaldlw commented 3 months ago

Okay. I checked this out on RPi3B+ and I found that a service (glamor-test) was adding a display driver for X. Since X is supposed to use the default driver, this tells it to use a different one, hence the problems you are having. Do the following on a RPi3B+:

sudo systemctl disable glamor-test.service sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf sudo systemctl restart lightdm

Let me know if that works.

that does seem to get the display working, thanks!

ronaldlw commented 3 months ago

Okay. I checked this out on RPi3B+ and I found that a service (glamor-test) was adding a display driver for X. Since X is supposed to use the default driver, this tells it to use a different one, hence the problems you are having. Do the following on a RPi3B+:

sudo systemctl disable glamor-test.service sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf sudo systemctl restart lightdm

Let me know if that works.

Is the script going to be updated to incorporate these fixes?

ronaldlw commented 3 months ago

here are the updated commands including what is done in raspi-config to disable wayland and enable x:

sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf
sudo sed -e '/dtoverlay=vc4/ s/^#*/#/' -i /boot/firmware/config.txt
sudo sed -i -e '/greeter-session=/ s/=.*/=pi-greeter/' /etc/lightdm/lightdm.conf
sudo sed -i -e '/user-session=/ s/=.*/=LXDE-pi-x/' /etc/lightdm/lightdm.conf
sudo sed -i -e '/autologin-session=/ s/=.*/=LXDE-pi-x/' /etc/lightdm/lightdm.conf
sudo systemctl disable glamor-test.service

Then the rest is the same as normal, but also some of my specific changes if anyone else would be interested:

git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show

#force the resolution to be 720 x 480 the display scales it and makes it more usable and is still pretty clear
sudo sed -i -e '/hdmi_cvt / s/480 320/ 720 480/' ./LCD35-show

#rotate the display 180 so the power plug is on top instead of the bottom
sudo ./LCD35-show 180
OldWoman37 commented 3 months ago

Okay. I have a bit more of an explanation of what is going on here. If you look at: https://indico.freedesktop.org/event/2/contributions/60/attachments/66/107/XDC-20220-DRI3-modesetting-without-glamor.pdf You will see there is a potential issue of running out of memory using a RPi device with lower memory (<1GB). The OpenGL acceleration can use more RAM thus reducing the amount of memory for your CPUs resulting in termination of some programs. Granted you have to be doing quite a bit of stuff for this to happen, but it can happen. So the service "glamor-test" checks for this and disables that acceleration. The problem for us is that X has a weird way of doing configurations. Before, they had just one file where you put in all your systems info and it just worked. But with todays systems, the configuration is more dynamic and rather than using a single file, we have multiple files, and the order in which they are read can cause problems. This is a known issue, however the X maintainers try to make it work with the most common systems. Our configuration is not the case, so this "glamor-test" services will work on a stock configuration, but not ours. So the patch I provided above is good as long as you keep what you are running to a minimum (ie. a few tabs in a browser). If you aren't running a browser at all, you will probably be fine. Otherwise, you can do this:

sudo systemctl disable glamor-test.service
sudo cat /usr/share/X11/xorg.conf.d/20-noglamor.conf | sed -e '/EndSection/i Driver "fbdev"' > /usr/share/X11/xorg.conf.d/21-noglamor.conf
sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf
sudo systemctl restart lightdm

What is different he from the previous solution is that OpenGL is still disabled, but I the display driver is specified after (ie. "fbdev") which results in X starting up properly. So this is a better choice if you will run heavier applications and don't want to risk loosing too much RAM to the OpenGL system. One warning though: if you move your installation (SD card) into another system, like a RPi4 or better, you will need to re-enable the glamor-test service as well as delete the 21-noglamor.conf file.

maxpaine69 commented 3 months ago

Do you have the: dtoverlay=tft35a:rotate=90 line in your /boot/firmware/config.txt file? Does your /boot/firmware/overlays folder contain tft35a.dtbo and tft35a-overlay.dtb? After boot, do you have a "fbcp" process running?

yes to every thing, i even created a new instaltion

sudo systemctl restart lightdm

resulted on the pi zero 2w.

OldWoman37 commented 3 months ago

Do you have the: dtoverlay=tft35a:rotate=90 line in your /boot/firmware/config.txt file? Does your /boot/firmware/overlays folder contain tft35a.dtbo and tft35a-overlay.dtb? After boot, do you have a "fbcp" process running?

yes to every thing, i even created a new instaltion

sudo systemctl restart lightdm

resulted on the pi zero 2w.

Did you do what I posted yesterday?

mayurnewase commented 3 months ago

had same issue with 3B+ and Bookworm, ran commands from both these comments

https://github.com/goodtft/LCD-show/issues/369#issuecomment-2115596683 https://github.com/goodtft/LCD-show/issues/369#issuecomment-2116552991

then checked processes running, fbcp wasn't in the list, so reinstalled the drivers again, then it screen started working. Thanks @OldWoman37 @ronaldlw

Elmiar0642 commented 3 months ago

Okay. I have a bit more of an explanation of what is going on here. If you look at: https://indico.freedesktop.org/event/2/contributions/60/attachments/66/107/XDC-20220-DRI3-modesetting-without-glamor.pdf You will see there is a potential issue of running out of memory using a RPi device with lower memory (<1GB). The OpenGL acceleration can use more RAM thus reducing the amount of memory for your CPUs resulting in termination of some programs. Granted you have to be doing quite a bit of stuff for this to happen, but it can happen. So the service "glamor-test" checks for this and disables that acceleration. The problem for us is that X has a weird way of doing configurations. Before, they had just one file where you put in all your systems info and it just worked. But with todays systems, the configuration is more dynamic and rather than using a single file, we have multiple files, and the order in which they are read can cause problems. This is a known issue, however the X maintainers try to make it work with the most common systems. Our configuration is not the case, so this "glamor-test" services will work on a stock configuration, but not ours. So the patch I provided above is good as long as you keep what you are running to a minimum (ie. a few tabs in a browser). If you aren't running a browser at all, you will probably be fine. Otherwise, you can do this:

sudo systemctl disable glamor-test.service
sudo cat /usr/share/X11/xorg.conf.d/20-noglamor.conf | sed -e '/EndSection/i Driver "fbdev"' > /usr/share/X11/xorg.conf.d/21-noglamor.conf
sudo rm /usr/share/X11/xorg.conf.d/20-noglamor.conf
sudo systemctl restart lightdm

What is different he from the previous solution is that OpenGL is still disabled, but I the display driver is specified after (ie. "fbdev") which results in X starting up properly. So this is a better choice if you will run heavier applications and don't want to risk loosing too much RAM to the OpenGL system. One warning though: if you move your installation (SD card) into another system, like a RPi4 or better, you will need to re-enable the glamor-test service as well as delete the 21-noglamor.conf file.

After doing this the screen boots up, but even after setting boot up to GUI, the screen starts in tty1 in terminal. I created even xinitrc and checked. Gnome or cinnamon doesn't open. Why is that?