Volumio and Waveshare 1024x600 touch screen issue

Hi,

I’ve been having a bit of trouble getting the touch screen working with Volumio and my Pi 3B+ and Waveshare 7" 1024x600 screen.
After installing the touch plugin, touch still wasn’t working. I’ve had to manually copy the 99-calibration.conf as well as 99-fbturbo.conf to /usr/share/X11/xorg.conf.d. This did get the touch working but on a rotated axis.
Adding a transform to 99-calibration.conf resolver this ( Option “TransformationMatrix” “0 1 0 -1 0 1 0 0 1”)
This leaves me with a working touch screen that is correctly orientated but appears to have a mismatch in resolution.
As the touch approaches the edge of the screen, allignment with the cursor worsens.

I have tried

DISPLAY=:0.0 xinput_calibrator --precalib 200 3900 200 3900

(the x and y values match the config used by Waveshare in the dtoverlay line in /boot/config.txt) but this made no difference.

Does anyone know of any way to check this or what may be causing the issue?

Many thanks
Rad

Please connect to Volumio via SSH and post the output of

cat /boot/config.txt

and

cat /boot/userconfig.txt

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
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0
hdmi_drive=1
dtoverlay=ads7846:cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swap-xy=1,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

include userconfig.txt

There is no data in userconfig.txt

Thanks

Here’s a picture showing the issue

Could you try removing

dtoverlay=ads7846:cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swap-xy=1,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

from /boot/config.txt?

Without that line, the touch does not work.

I tried changing the line to:

dtoverlay=ads7846:cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swap-xy=0

which allows the touch to work but still exhibits the issue.

I assumed the screen is the Waveshare 7inch HDMI LCD (C). Is that correct?

I believe it’s the Waveshare 7inch HDMI LCD

Ok, then you need the overlay… :wink:

Did you already try the settings recommended by Waveshare for “99-calibration.conf”? If not substitute the content of “99-calibration.conf” with:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "73 4007 3976 84"
        Option  "SwapAxes"      "1"
EndSection

These values have been taken from here. You may also try the differing values from the wiki page your link is pointing to.

One more thing regarding

dtoverlay=ads7846:cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swap-xy=1,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

Because this line exceeds 80 characters it needs to be split like this:

dtoverlay=ads7846
dtparam=cs=1
dtparam=penirq=25
dtparam=penirq_pull=2
dtparam=speed=50000
dtparam=keep_vref_on=0
dtparam=swapxy=1
dtparam=pmax=255
dtparam=xohms=150
dtparam=xmin=200
dtparam=xmax=3900
dtparam=ymin=200
dtparam=ymax=3900

Without that splitting all parameters after “keep_vref_on=0” would be ignored.

BTW: The config.txt recommendation on Waveshare’s GitHub repo shows “swapxy=0”.

I tried the aternative settings in “99-calibration.conf” which had no effect.

I also tried splitting the settings layout as you suggest in /boot/config.txt but this stops the touch working completely.

I had already changed “swapxy” to 0 after changing it to 1 had no effect on switching the axis.

I think you need to add

dtparam=spi=on

to /boot/config.txt. IIRC it needs to be placed prior to the overlay entry ( “dtoverlay=ads7846…”).

Unfortunately, the touch still doesn’t work with that setting in place and the dtparam on separate lines.

This feels so close to working that I think I must be missing a config file somewhere, or the Touch plugin installed a config with it’s own settings that don’t match the settings I need for the screen.

Please post the results of

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

and

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

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

total 40
drwxr-xr-x 2 root root 4096 May  7 09:01 .
drwxr-xr-x 1 root root 4096 May  4 13:29 ..
-rw-r--r-- 1 root root 1350 Nov 11  2016 10-quirks.conf
-rw-r--r-- 1 root root  788 Sep 30  2016 40-libinput.conf
-rw-r--r-- 1 root root 2747 Oct 28  2016 70-wacom.conf
-rwxr-xr-x 1 root root  411 May  7 13:58 99-calibration.conf
-rwxr-xr-x 1 root root  356 May  6 17:20 99-calibration.conf.old
-rw-r--r-- 1 root root  647 May  7 09:01 99-fbturbo.conf

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

total 28
drwxr-xr-x 2 root root 4096 May  7 14:39 .
drwxr-xr-x 1 root root 4096 May  4 13:33 ..
-rw-r--r-- 1 root root  316 May  7 14:39 95-touch_display-plugin.conf
-rwxr-xr-x 1 root root  477 May  7 14:38 99-calibration.conf
-rwxr-xr-x 1 root root  440 May  6 19:14 99-calibration.conf.save

The contents of 99-fbturbo.conf are:

Section “Device”
Identifier “Allwinner A10/A13 FBDEV”
Driver “fbturbo”
Option “fbdev” “/dev/fb0”

    Option          "SwapbuffersWait" "true"

EndSection

What’s the content of “/etc/X11/xorg.conf.d/99-calibration.conf” please?

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

Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Option “MinX” “208”
Option “MaxX” “3905”
Option “MinY” “288”
Option “MaxY” “3910”
Option “SwapAxes” “0”
Option “EmulateThirdButton” “1”
Option “EmulateThirdButtonTimeout” “1000”
Option “EmulateThirdButtonMoveThreshold” “300”
Option “TransformationMatrix” “0 1 0 -1 0 1 0 0 1”
EndSection

From the information I gather from Waveshare it seems the screens needs evdev. Maybe you need to run

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

and after that

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

This has had an effect - the cursor now moves ahead of the touch point instead of trainling behind.

I tried another calibration with

DISPLAY=:0.0 xinput_calibrator --precalib 200 3900 200 3900

But this didn’t help after placing the new calibration numbers in “/etc/X11/xorg.conf.d/99-calibration.conf” and “/usr/share/X11/xorg.conf.d/99-calibration.conf”

Could the fact the /boot/config.txt dowsn’t work when setting the params on separate lines be an issue? If later params are being ignored when used on a single line (which is the only way I seem to be able to get the touch working) then the x and y values may not be set

You don’t need to work on both files. The file in “/etc/X11/xorg.conf.d” should overrule the identically named one in “/usr/share/X11/xorg.conf.d”.

Did you try substituting the content of “/etc/X11/xorg.conf.d/99-calibration.conf” with the lines from post #7?

IMHO the one line entry would cause that the parameters starting from “swapxy” would not be respected.

You might remove the parameter keep_vref_on=0 as this seems not be valid for the ads7846 overlay (readme).

How is your “/boot/config.txt” looking now?

Sorry - I’ve been looking at settings but progress seems to have been made.
I’m now pretty close to calibrated on the X axis but still nowhere near on the Y.

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
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0
hdmi_drive=1
dtparam=spi=on
dtoverlay=ads7846:cs=1,penirq=25,penirq_pull=2,speed=50000,xohms=150