Help Needed: LAFVIN 3.5" Screen Issues with Zynthian v5 on Raspberry Pi 4

Hello everbody,
I recently discovered Zynthian v5 and fell in love with it. I decided to burn the latest image onto an SD card and insert it into my Raspberry Pi 4. So far, so good. Then I decided to purchase this screen:

#LAFVIN 3,5 inch 480x320 TFT Touch Screen SPI Display Monitor

It is an SPI resistive touchscreen

After installing it, I tried some screen presets in the webconfig and discovered that PiScreen V1 was working, except for the touchscreen, which was completely misaligned. Having extensively read the forum, I was prepared for this issue. Following the forum’s advice, I connected via SSH using PuTTY and started following the screen vendor’s instructions on how to install the drivers and calibrate the monitor, as stated here:

After the forced reboot, the screen no longer boots into the Zynthian-UI. Instead, it shows the Pi shell prompting for a Zynthian login. I logged in as root and started the calibration procedure, hoping that on the next reboot it would launch the Zynthian-UI:

However, the entire process fails because it complains about not finding the X server. Can anyone with more experience point me in the right direction?

Thank you in advance for your help.

Hi and welcome in Zynthianland.

The LCDshow script has overwriten some configuration files and broke Zynthian setup.
You better burn a new image imo and go with piscreen driver (it makes the display to work ) and then try to solve the touch issue.

Thank you for your kind reply. I actually thought about this approach, but I couldn’t find (or understand) any way to rotate just the touch input without rotating the entire GUI.

I should mention that I tried going to Admin → Touch Calibration, but it didn’t solve the issue. Even after calibration, the touch input remains in the same orientation as before.

Have you tried editing the dtoverlay paramenters in the webconf?
I also had inverted touch, and managed to set it up from there.

Thank you for the advice. I have a couple of follow-up questions for clarification:

  1. Am I correct in understanding that lines beginning with ‘#’ are comments and not interpreted by the system?

  2. Is the ‘SwapXY’ parameter specifically relevant for inverting only the touch input orientation? Because I think I’ve already tried it without any successful results.

  3. Is there any comprehensive documentation available that explains each of these parameters in detail?"

These displays are a real pain.

  1. You’re right

  2. Swapxy is a directive for display settings not for touch I bélier

  3. there are some forum posts here about these infamous displays

You poor soul! There are many warning throughout this forum about screens like this. They are pretty bad with poor support and can be challenging to get working. However, things have improved since I spent (what felt like) a lifetime trying to get one working


That was foolish! It sounds like a good plan but in this case, it breaks the OS. This vendor tends to only support one particular version of an OS and if you vary from that then you will break your machine. As mentioned above, reflash you uSD and start again. Don’t follow those instruction.

You have not described the nature of the touchscreen calibration issue. Is it X axis inverted? Y axis inverted? Rotated through 90, 180, 270 degrees? X offset? Y offset? These all have different solutions.

If the X & Y axis are reversed then you can change swapxy=0.

If the Y & Y axes are inverted and you are able to mount the screen upside down then you could change dtoverlay=piscreen2r-notouch,rotate90

If there is just an offset on X & Y then use calibration in admin menu.

If something else then please describe so we can help.

I’m back home, and as I’ve got the same kind of display, I’ve give it a try once again. An I’ve got it to work

My Zynthian is “close to the bleeding edge Oram”, while downloadable image is from June. They have been some significant changes in between, on Zynthian’s side but also on RaspiOs side.

Here I’m using waveshare 35a as driver
So, first update your Zynthian Oram, switch to waveshare 35a in HW config and reboot.

Once rebooted, from command line

systemctl stop zynthian

apt install xinput-calibrator

export DISPLAY=:0

startx&

xinput_calibrator

=> calibrate touchscreen. This will output some infos in terminal:

zynthian# xinput_calibrator
Setting calibration data: 0, 4095, 0, 4095
Calibrating EVDEV driver for “ADS7846 Touchscreen” id=6
current calibration values (from XInput): min_x=0, max_x=4095 and min_y=
0, max_y=4095

Doing dynamic recalibration:
Setting calibration data: 3895, 243, 815, 3357
→ Making the calibration permanent ←
copy the snippet below into ‘/etc/X11/xorg.conf.d/99calibration.conf’ (/usr/share/X11xorg.conf.d/ in some distro’s)

Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Option “Calibration” “3895 243 815 3357”
Option “SwapAxes” “0”
EndSection

Let’s do it:

nano /etc/X11/xorg.conf.d/99calibration.conf

put the given directives in it, save file and exit nano, start Zynthian and cross fingers:

systemctl start zynthian

Touch interface seems to work the right way (but I didn’t test all the Zynthian’s corners yet)

HARDWARE

Raspberry Pi 3 Model B Rev 1.2
Audio: Custom device
Display: WaveShare 3.5A
Wiring: DUMMIES
I2C: Not detected
Profile:

SOFTWARE

zyncoder: oram (62626a8)
zynthian-ui: oram (31d8d20)
zynthian-sys: oram (5affa51)
zynthian-data: oram (e222e11)
zynthian-webconf: oram (f31699f)

While after the above hack, touchscreen feature looks okay, I’ve navigate to admin-> calibrate touchscreen

It brokes touchscreen and /etc/X11/xorg.conf/99calibration.conf content is:

Section “InputClass” # Created 2024-08-02 12:28:40.625099
Identifier “calibration”
MatchProduct “6”
Option “TransformationMatrix” “-0.985337 0.000000 1.004018 0.000000 -1.009009 0.985714 0.000000 0.000000 1.000000”
EndSection

Before (when OK) it was:

Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Option “Calibration” “3895 243 815 3357”
Option “SwapAxes” “0”
EndSection

Thanks a lot! I’ll try that as soon as I get home (3hrs or so) and I’ll let you know :wink:

Just a quick question, do you please have a direct link to the ORAM image to be burned on the SD card?

This is not correct, it swaps XY for touch, so here are my working parameters for waveshare 35a:

dtoverlay=waveshare35a:rotate=270,swapxy=0

https://wiki.zynthian.org/index.php/Zynthian_Software

Use Oram and update software :wink:

Sooo sorry for the big delay on my answer, it worked, the @ReCremisi89 solution was the one that worked for me :wink:

3 Likes