Volumio with 3.5" TFT Touch Screen (GPIO) RPi 3B+

where should i change it?
im boot config.txt?

everithing is working just fine, i just let it be right now… thanks a lot!

:+1: I suggest to move

dtoverlay=tft35a:rotate=...

from “/boot/config.txt” to “/boot/userconfig.txt” (respectively to use only the entry in “userconfig.txt”): In contrast to “/boot/config.txt” which gets overwritten each time Volumio is updated, “/boot/userconfig.txt” remains untouched (further information).

Hi, Thanks to @gvolt advice, I have successfully connected my 3.5" screen, I’ve detailed what I’ve done here.

A little detail that bother me : I can’t make touch to the borders of the screen (about 4 millimeters). Something like that (the cursor can’t go over the red zone) :
image

I presume that I have to modify 99-calibration.conf but it doesn’t seems to have any effect.
Do I need to use evdev to calibrate ? How to choose the right values ?

Here my actual configuration :

cat /boot/config.txt

initramfs volumio.initrd
gpu_mem=32
max_usb_current=1
dtparam=audio=on
audio_pwm_mode=2
dtparam=i2c_arm=on
disable_splash=1
hdmi_force_hotplug=1
force_eeprom_read=0

include userconfig.txt

cat /boot/userconfig.txt

dtparam=spi=on
dtoverlay=tft35a:rotate=90

ls -al /etc/X11/xorg.conf.d

95-touch_display-plugin.conf
99-calibration.conf
99-swapxy.conf
99-swapxy.conf.save

cat /etc/X11/xorg.conf.d/99-calibration.conf

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "268 3880 227 3936"
        Option  "SwapAxes"      "0"
EndSection

cat /etc/X11/xorg.conf.d/99-swapxy.conf

Section "InputClass"
        Identifier "SwapXY"
        Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
        MatchIsTouchscreen "on"
EndSection

cat /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Section "Device"
        Identifier      "Allwinner A10/A13/A20 FBDEV"
        Driver          "fbdev"
        Option          "fbdev" "/dev/fb1"
        Option          "SwapbuffersWait" "true"
EndSection

Probably you don’t have installed “xserver-xorg-input-evdev” currently. This is necessary for the settings in “99-calibration.conf” to take effect.

Install “xserver-xorg-input-evdev” by running

sudo apt-get -y install xserver-xorg-input-evdev

After that execute

sudo cp /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

“/etc/X11/xorg.conf.d/99-swapxy.conf” can/should be removed.

Reboot.

It works :wink:
How do you know so well how to configure these screens :sweat_smile: ?

Just have to make some tune to be able to arrive on the left border. So I need to understand what the “Option Calibration” values are.

If I remove my 99-swapxy.conf my touch is not in the right direction anymore (the touch is turned of 90° anti-clockwise ). 99-swapxy.conf is not the right way to rotate the touch input ?

Just try out the rotation setting on the plugin’s config page. For your screen this option does not affect the display but should (only) affect the touch screen.

If I put another value than 0 degree in the plugin options I have the logon screen only after reboot :sweat_smile:

So the Volumio UI does not start?

Please post the result of

cat /var/log/Xorg.0.log

when this happens.

I think volumio boot correctly, on the screen it displays I see:

Raspbian GNU/Linux 10 volumio tty1

Welcome to Volumio!
WebUI available at volumio.local
volumio login:
cat /var/log/Xorg.0.log`
volumio@volumio:~$ cat /var/log/Xorg.0.log
cat: /var/log/Xorg.0.log: No such file or directory
volumio@volumio:~$
volumio@volumio:~$
volumio@volumio:~$ cat /var/log/Xorg.0.log
[    45.686]
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[    45.687] Build Operating System: Linux 5.4.0-72-generic armv8l Raspbian
[    45.687] Current Operating System: Linux volumio 5.10.90-v7+ #1512 SMP Thu Jan 13 16:32:54 GMT 2022 armv7l
[    45.688] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1016 bcm2708_fb.fbheight=1856 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  splash plymouth.ignore-serial-consoles dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 quiet console=ttyS0,115200 console=tty1 imgpart=/dev/mmcblk0p2 imgfile=/volumio_current.sqsh rootwait bootdelay=5 elevator=noop logo.nologo vt.global_cursor_default=0 net.ifnames=0 snd-bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 loglevel=0
[    45.689] Build Date: 04 January 2022  10:05:34AM
[    45.689] xorg-server 2:1.20.4-1+rpt4+deb10u4 (https://www.debian.org/support)
[    45.689] Current version of pixman: 0.36.0
[    45.690]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[    45.690] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    45.693] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Jan 27 14:38:18 2022
[    45.702] (==) Using config directory: "/etc/X11/xorg.conf.d"
[    45.703] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    45.710] (==) No Layout section.  Using the first Screen section.
[    45.710] (==) No screen section available. Using defaults.
[    45.710] (**) |-->Screen "Default Screen Section" (0)
[    45.710] (**) |   |-->Monitor "<default monitor>"
[    45.717] (==) No device specified for screen "Default Screen Section".
        Using the first device section listed.
[    45.717] (**) |   |-->Device "Allwinner A10/A13/A20 FBDEV"
[    45.717] (==) No monitor specified for screen "Default Screen Section".
        Using a default monitor configuration.
[    45.717] (==) Automatically adding devices
[    45.717] (==) Automatically enabling devices
[    45.717] (==) Automatically adding GPU devices
[    45.717] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    45.718] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    45.718]    Entry deleted from font path.
[    45.719] (==) FontPath set to:
        /usr/share/fonts/X11/misc,
        /usr/share/fonts/X11/100dpi/:unscaled,
        /usr/share/fonts/X11/75dpi/:unscaled,
        /usr/share/fonts/X11/Type1,
        /usr/share/fonts/X11/100dpi,
        /usr/share/fonts/X11/75dpi,
        built-ins
[    45.719] (==) ModulePath set to "/usr/lib/xorg/modules"
[    45.719] (II) The server relies on udev to provide the list of input devices.
        If no devices become available, reconfigure udev or disable AutoAddDevices.
[    45.719] (II) Loader magic: 0x1fdf80
[    45.719] (II) Module ABI versions:
[    45.719]    X.Org ANSI C Emulation: 0.4
[    45.719]    X.Org Video Driver: 24.0
[    45.719]    X.Org XInput driver : 24.1
[    45.719]    X.Org Server Extension : 10.0
[    45.722] (--) using VT number 2

[    45.722] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[    45.722] (II) no primary bus or device found
[    45.723] (II) LoadModule: "glx"
[    45.726] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    45.795] (II) Module glx: vendor="X.Org Foundation"
[    45.795]    compiled for 1.20.4, module version = 1.0.0
[    45.795]    ABI class: X.Org Server Extension, version 10.0
[    45.795] (II) LoadModule: "fbdev"
[    45.797] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[    45.800] (II) Module fbdev: vendor="X.Org Foundation"
[    45.800]    compiled for 1.20.3, module version = 0.5.0
[    45.800]    Module class: X.Org Video Driver
[    45.800]    ABI class: X.Org Video Driver, version 24.0
[    45.800] (II) FBDEV: driver for framebuffer: fbdev
[    45.802] (WW) Falling back to old probe method for fbdev
[    45.802] (II) Loading sub module "fbdevhw"
[    45.802] (II) LoadModule: "fbdevhw"
[    45.803] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[    45.805] (II) Module fbdevhw: vendor="X.Org Foundation"
[    45.805]    compiled for 1.20.4, module version = 0.0.2
[    45.805]    ABI class: X.Org Video Driver, version 24.0
[    45.805] (EE) open /dev/fb1: No such file or directory
[    45.805] (WW) Falling back to old probe method for fbdev
[    45.805] (II) Loading sub module "fbdevhw"
[    45.805] (II) LoadModule: "fbdevhw"
[    45.806] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[    45.806] (II) Module fbdevhw: vendor="X.Org Foundation"
[    45.806]    compiled for 1.20.4, module version = 0.0.2
[    45.806]    ABI class: X.Org Video Driver, version 24.0
[    45.806] (EE) open /dev/fb1: No such file or directory
[    45.806] (EE) No devices detected.
[    45.806] (EE)
Fatal server error:
[    45.806] (EE) no screens found(EE)
[    45.806] (EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
[    45.806] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    45.806] (EE)
[    45.809] (EE) Server terminated with error (1). Closing log file.

Now please post the output of

ls -al /etc/X11/xorg.conf.d

ls -al /usr/share/X11/xorg.conf.d

and

ls -al /dev/fb*

ls -al /etc/X11/xorg.conf.d

-rw-r--r-- 1 root root  375 Jan 27 14:38 95-touch_display-plugin.conf
-rw-r--r-- 1 root root  204 Jan 27 14:29 99-calibration.conf
-rw-r--r-- 1 root root  151 Jan 27 14:14 99-swapxy.conf.old
-rw-r--r-- 1 root root  151 Jan 27 13:43 99-swapxy.conf.sav

ls -al /usr/share/X11/xorg.conf.d

-rw-r--r-- 1 root root   92 Feb  7  2019 10-amdgpu.conf
-rw-r--r-- 1 root root 1099 Aug 23  2018 10-evdev.conf
-rw-r--r-- 1 root root 1350 Jan  4 10:05 10-quirks.conf
-rw-r--r-- 1 root root   92 Apr  6  2019 10-radeon.conf
-rw-r--r-- 1 root root 1429 Mar 31  2019 40-libinput.conf
-rw-r--r-- 1 root root 1099 Jan 27 13:26 45-evdev.conf
-rw-r--r-- 1 root root 2747 Jun 26  2017 70-wacom.conf
-rw-r--r-- 1 root root  607 Jan 27 01:05 99-fbturbo.conf

ls -al /dev/fb*

crw-rw---- 1 root video 29, 0 Jan 27 14:37 /dev/fb0

It seems your display uses fb0 (which is puzzling me). So open “/usr/share/X11/xorg.conf.d/99-fbturbo.conf” with

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

and change

Option "fbdev" "/dev/fb1"

to

Option "fbdev" "/dev/fb0"

It works, thank you :wink:
It was probably due to the fact the I have my hdmi plug connected to a screen at the same time… :woozy_face: If I remove the hdmi plug I can stay with Option "fbdev" "/dev/fb1" sorry about that.

So have to edit my first post to simplify it with the details that you give me.

Last question (I hope :yum: ) more to know than a real necessity : how to find the best values for calibration ? I tried xinput_calibrator but the values are less good than something like Option "Calibration" "268 3880 227 3936"

Yes, that’s the reason… :grimacing:

I have no screen like yours and did never use “xinput_calibrate”, so ATM I have no idea why the values you get from “xinput_calibrate” are leading to a worse result.

Your values are from the goodtft github repo I think. What’s the brand and model name of your screen?

This is this cheap screen from Aliexpress.

When I look at the bottom I see this resistor called “LED_FUNCTION”… :thinking:
Now I’m asking myself if someone has managed backlight on these screens… Could be useful to switch off when Volumio goes in screensaver mode.

“LED_FUNCTION” could be just backlight on/off or PWM control. The PCB looks like a Kedei 3.5" display, but documentation is… sparse. :wink:

OK, I place the resistor to “ON” on “LED_FUNCTION” , now it allow to control backlight , I follow the trace and it can be controlled with GPIO 22 (which correspond to wiringpi pin number 3).

I’m now able to switch on and off the screen with gpio mode 3 out and then gpio write 3 1 or gpio write 3 0

But I’m not able to manage it with PWM , I tried something like this without success :

gpio -g mode 22 pwm      #Set the pin as PWM
gpio pwmc 100   
gpio -g pwm 22 0         #Set the brightness to dimmest
gpio -g pwm 22 1023      #Set the brightness to the brightest
gpio -g mode 22 out      #Clean the pin

My pwm commands seems to haven’t any effect, I don’t know why…
All GPIO of the RPI 3 are pwm capable ?

Not a big deal if I can’t dimmer the screen , how can I trigger the switch off of the screen at screensaver timeout (in touch display plugin) ?

I think GPIO 22 is not prepared for PWM, see PWM at Raspberry Pi GPIO Pinout.

As the display is using GPIO 22 for “LED_FUNCTION” it also probably has only the capability to switch the backlight on and off.

Possibly it is not necessary to control the backlight via GPIO. The Touch Display plugin uses DPMS to switch off the display as a screensaver. If the display should be DPMS compliant this would already switch off its backlight, too. Does the backlight of your display stay on after the screensaver timeout (set via the Touch Display plugin) has expired?

Now it is dimmable by PWM :laughing: :
image

I don’t think that this SPI screen is DPMS compliant… No it never switch off backlight even when Touch Display Plugin screensaver is activated.

In fact I just need to ON/OFF the screen so I found the plugin “gpio control” it was almost perfect to switch off my screen with my GPIO but it doesn’t work anymore with Volumio 3 :cry:

Is there a way to trigger a command line, a script or something when player stop/start on Volumio 3 ?

May be I could modify “touch_display/index.js” to execute my gpio write 3 0 when screensaver is activated… :thinking: