[SOLVED] Problems with touch on 3.2 inch shield

Post Reply
webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

[SOLVED] Problems with touch on 3.2 inch shield

Post by webber »

Apologies if this is the wrong place to ask about the 3.2 inch model, I couldn't find anywhere else.

I recently received a 3.2 inch touchscreen shield and have been unable to get the touch to work on an N2. The display itself is working just fine
I tried following the guide here https://wiki.odroid.com/accessory/displ ... id-c2n2c41

Here is the output from lsmod and the dmesg logs for the touchscreen driver

Code: Select all

root@odroid:~# lsmod
Module                  Size  Used by
fuse                  110592  3
cpufreq_ondemand       20480  0
cpufreq_powersave      16384  0
cpufreq_userspace      16384  0
cpufreq_conservative    16384  0
joydev                 24576  0
ads7846                24576  0
fb_hktft32             16384  1
fbtft                  53248  1 fb_hktft32
i2c_meson_master       20480  0
squashfs               49152  10
sch_fq_codel           20480  2
amvdec_vp9            122880  0
amvdec_vc1             65536  0
amvdec_real            45056  0
amvdec_mmpeg4          40960  0
amvdec_mpeg4           65536  0
amvdec_mpeg12         106496  0
amvdec_mmjpeg          28672  0
amvdec_mjpeg           40960  0
amvdec_h265           147456  0
amvdec_h264mvc         57344  0
amvdec_mh264          159744  0
amvdec_h264           147456  0
amvdec_avs             69632  0
stream_input          180224  8 amvdec_h265,amvdec_mh264,amvdec_h264mvc,amvdec_real,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs
decoder_common        188416  14 amvdec_h265,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mpeg4
firmware               28672  15 amvdec_h265,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,decoder_common,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mpeg4
media_clock            45056  9 amvdec_h265,amvdec_mh264,decoder_common,firmware,stream_input,amvdec_vp9,amvdec_h264,amvdec_mpeg12,amvdec_avs
ip_tables              28672  0
x_tables               49152  1 ip_tables
ipv6                  466944  52
spi_meson_spicc        20480  0

Code: Select all

root@odroid:~# dmesg | grep ads
[   10.270114] ads7846 spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[   10.270339] ads7846 spi0.1: touchscreen, irq 72
[   10.276004] ads7846 spi0.1: ads7846_probe ok! registered with irq (72)
[   67.552738] ads7846 spi0.1: SPI transfer timed out
[   67.552787] ads7846 spi0.1: spi_sync --> -110
Any help would be greatly appreciated
Last edited by webber on Sat Jul 31, 2021 1:32 am, edited 1 time in total.

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

A little update, it seems to work for a very short time immediately after boot but then it stops

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1205 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by odroid »

Which kernel version do you run on your N2?
Could you see a frame buffer console in a very short time? or x-window (Mate desktop)?
How is the backlight LED? Is it still on?

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

This is the Ubuntu 20 image with the 4.9.241-114 kernel. The display always works fine with console and x-window, it's just the touch driver that seems to fail a couple seconds after boot

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

Same behaviour with the ubuntu 18 image with the 4.9.241-77 kernel.

On a side note, maybe consider updating the following line in the wiki to reference the kernel version, not the OS version I think, since device tree overlays work on kernel version 4.9.230 and up
temp.png
temp.png (71.72 KiB) Viewed 802 times

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

Maybe this would be helpful too

Code: Select all

root@odroid:~# dmesg | grep spi
[    9.287621] meson-spicc ffd13000.spi: registered master spi0
[    9.288937] spi spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[    9.289037] meson-spicc ffd13000.spi: registered child spi0.1
[    9.289050] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max --> 0
[    9.289105] meson-spicc ffd13000.spi: registered child spi0.0
[    9.353364] ads7846 spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[    9.357721] ads7846 spi0.1: touchscreen, irq 72
[    9.358290] input: ADS7846 Touchscreen as /devices/platform/soc/ffd00000.cbus/ffd13000.spi/spi_master/spi0/spi0.1/input/input3
[    9.358429] ads7846 spi0.1: ads7846_probe ok! registered with irq (72)
[    9.718527] graphics fb4: fb_hktft32 frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=20, spi0.0 at 40 MHz
[   10.892228] ads7846 spi0.1: SPI transfer timed out
[   17.836209] ads7846 spi0.1: SPI transfer timed out
[   17.836252] ads7846 spi0.1: spi_sync --> -110

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

I can restore touch functionality for another couple seconds by removing and adding the ads7846 driver again. It seems to work up until the driver decides it hasn't received a response signal so I'm not sure if it's a bug in the driver or a hardware defect

Code: Select all

root@odroid:~# dmesg | grep ads
[    9.401646] ads7846 spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[    9.401849] ads7846 spi0.1: touchscreen, irq 72
[    9.402463] ads7846 spi0.1: ads7846_probe ok! registered with irq (72)
[   10.992656] ads7846 spi0.1: SPI transfer timed out
[   18.076633] ads7846 spi0.1: SPI transfer timed out
[   18.076675] ads7846 spi0.1: spi_sync --> -110
root@odroid:~# modprobe -r ads7846
root@odroid:~# modprobe ads7846
root@odroid:~# dmesg | grep ads
[    9.401646] ads7846 spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[    9.401849] ads7846 spi0.1: touchscreen, irq 72
[    9.402463] ads7846 spi0.1: ads7846_probe ok! registered with irq (72)
[   10.992656] ads7846 spi0.1: SPI transfer timed out
[   18.076633] ads7846 spi0.1: SPI transfer timed out
[   18.076675] ads7846 spi0.1: spi_sync --> -110
[  130.031878] ads7846 spi0.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[  130.036455] ads7846 spi0.1: touchscreen, irq 72
[  130.046418] ads7846 spi0.1: ads7846_probe ok! registered with irq (72)
[  131.310956] ads7846 spi0.1: SPI transfer timed out
[  131.310994] ads7846 spi0.1: spi_sync --> -110

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1205 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by odroid »

Sorry for late reply. I had a vacation.

Do you mean that touch screen worked for few seconds just after running modprobe ads7846 driver?
We will try reproducing the issue tomorrow on Ubuntu 20.04 with Kernel 4.9.241-114.

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

No worries, hope you had a good rest :)

yes, it seems to work up until the dmesg log that says "SPI transfer timed out"

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1205 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by odroid »

We could reproduce the issue. :o
I think some of recent kernel updates might break the touchscreen driver functionality. :(

We might need a few working days to release a solution.
These users thanked the author odroid for the post:
webber (Sat Jul 24, 2021 1:04 am)

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

ooo ok. thanks for the help

joshua.yang
Posts: 526
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 37 times
Been thanked: 162 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by joshua.yang »

Hello.

Sorry for the late reply. I looked into the ads7846 DTBO configurations and did a little adjust its SPI frequency to double.

I attached the new ads7846.dtbo file so please test with that. Downloads this into your Odroid-N2 and overwrite the current file like the below.

Code: Select all

sudo cp -f ads7846.dtbo /media/boot/amlogic/overlays/odroidn2/
Then please let us know the results.
Thanks.
Attachments
ads7846.zip
(535 Bytes) Downloaded 8 times
These users thanked the author joshua.yang for the post:
webber (Fri Jul 30, 2021 1:53 am)

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

That works! The only issue I have now is that the x-axis of the touchscreen is inverted and the calibration file doesn't seem to do anything, including changing the "InvertX" option. I've tried putting it into the /usr/share/X11/xorg.conf.d/ directory as well as the /etc/X11/xorg.conf.d/ and neither seem to affect anything at all. Here's file the tool pushed out for reference

Code: Select all

Calibrating standard Xorg driver "ADS7846 Touchscreen"
        current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
        If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
        --> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "MinX"  "30941"
        Option  "MaxX"  "1314"
        Option  "MinY"  "2480"
        Option  "MaxY"  "53634"
        Option  "SwapXY"        "0" # unless it was already set to 1
        Option  "InvertX"       "0"  # unless it was already set
        Option  "InvertY"       "0"  # unless it was already set
EndSection

Last edited by webber on Fri Jul 30, 2021 3:31 am, edited 2 times in total.

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

I also tried using a transformation matrix as mentioned here viewtopic.php?f=145&t=34252&p=249988#p249826 but it didn't do anything either

joshua.yang
Posts: 526
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 37 times
Been thanked: 162 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by joshua.yang »

Glad to hear that DTBO works for you.

By the way, I could reproduce that the calibration method doesn't work properly.
So after a few searches, I found an alternative way to calibrate the touchscreen. And I confirmed this works on N2.

Referred this page: https://github.com/notro/fbtft/issues/445

1. Remove /etc/X11/xorg.conf.d totally. And remove all the things you tried to calibrate.
2. Download a package for evdev for input devices

Code: Select all

sudo apt install xserver-xorg-input-evdev
3. Create a file /usr/share/X11/xorg.conf.d/99-calibration.conf
4. Put this contents into that file.

Code: Select all

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Driver "evdev"
EndSection
5. Restart the lightdm service using sudo service lightdm restart
6. Do calibration using xinput_calibrator.
7. Put the results into the 99-calibration.conf file.

So that my working configuration is the below.

Code: Select all

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "3748 165 133 3867"
        Option  "SwapAxes"      "0"
        Driver "evdev"
EndSection
Hope it works. If you could confirm this, I will update our Wiki page.
These users thanked the author joshua.yang for the post:
webber (Sat Jul 31, 2021 1:30 am)

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: Problems with touch on 3.2 inch shield

Post by webber »

that worked! thanks for all the help
These users thanked the author webber for the post:
odroid (Mon Aug 02, 2021 10:12 am)

joshua.yang
Posts: 526
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 37 times
Been thanked: 162 times
Contact:

Re: [SOLVED] Problems with touch on 3.2 inch shield

Post by joshua.yang »

I have updated our Wiki page. Thanks for the report.

https://wiki.odroid.com/accessory/displ ... ouchscreen

webber
Posts: 42
Joined: Tue May 05, 2020 8:10 am
languages_spoken: english
ODROIDs: C2 C4 N2 XU4
Has thanked: 10 times
Been thanked: 4 times
Contact:

Re: [SOLVED] Problems with touch on 3.2 inch shield

Post by webber »

Hey, just following up on this issue. I noticed that the kernel has not been updated with the ads7846.dtbo patch from joshua.yang. Are there plans to do so?

Thanks

Post Reply

Return to “3.5inch LCD Shield”

Who is online

Users browsing this forum: No registered users and 0 guests