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.33k stars 797 forks source link

Success story #12

Open slavkoja opened 7 years ago

slavkoja commented 7 years ago

Hi, this is not bugreport, but succesreport ;-)

Recently i bought the 3,5" HDMI LCD, marked with 2017/2/1 version, i read some driver installation instructions, i download driver LCD_show_35hdmi.tar.gz from http://en.kedei.net/ and inspect it little. In install script i found, that it install (copies) a lot of binary files for some older kernel. As longtime Debian user i decided to try it with current Raspberry Pi kernel, without any files installed/copied into /usr directory. After search on internet i found your repository and i see that it can be reasonable solution (thanks for infos). To be sure, i start with fresh full raspbian jessie image (2017-04-10), where i did only two changes - i enabled ssh and configured network.

Settings

Display

Display works out of box, after i plug it and power the RasPi i can see GUI, but it uses too high resolution (i didn't inspect exact value). Then i took HDMI settings from driver's config.txt and placed into /boot/config.txt:

hdmi_group=2
hdmi_mode=87
hdmi_cvt=480 320 60 6 0 0 0
hdmi_drive=2

After reboot, the display show nice 480x320 screen.

Touchscreen

This was a big problem for me, because i did not encounter with touchscreens before and therefore i had zero experiences with. But after many try-error attempts i was finally success.

I start with enabling touchscreen overlay. First i start from driver's config, then i tried your config and finally i have in /boot/config.txt:

dtparam=spi=on
dtoverlay=ads7846,cs=0,penirq=25,penirq_pull=2,speed=10000,keep_vref_on=0,swapxy=1,pmax=255,xohms=150,xmin=199,xmax=3900,ymin=199,ymax=3900

After reboot the touchscreen work, but the X/Y axis are flipped and setting swapxy has no effect. Then i noticed xserver-xorg-input-evdev package in your repo, then i uninstall the xserver-xorg-input-all and xserver-xorg-input-libinput and install from official repo the xserver-xorg-input-evdev:

aptitude purge xserver-xorg-input-all xserver-xorg-input-libinput
aptitude install xserver-xorg-input-evdev

I tried to copy /usr/share/X11/xorg.conf.d/10-evdev.conf as you suggests, but it has no effect for me, then i revert it back this file. but i leave these packages (un)installed.

Then i install xinput-calibrator from official repo (BTW version 0.7.5+git20140201-1):

aptitude install xinput-calibrator

Then i add 99-calibration.conf from your repo into /etc/X11/xorg.conf.d/. After xserver restart the touchscreen works better, the axis was not flipped, but was inverted now. Then i add into 99-calibration.conf:

Option "InvertX" "1"
Option "InvertY" "1"

After xserver restart, the touschscreen starts to work and i was able to run (via ssh, i have no keyboard connected into Raspi):

DISPLAY=:0 xinput_calibrator

After finishing calibration it provides setting for me:

Section "InputClass"
    Identifier      "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option          "Calibration"   "188 3928 3895 117"
    Option          "SwapAxes"      "1"
EndSection

I replaced content of 99-calibration.conf by these settings, restart xserver and touchscreen works as expected.

Audio

I didn't try yet.

Conclusion

Although i am not sure about xserver-xorg-input-evdev/xserver-xorg-input-libinput step, the HDMI display with SPI touchscreen works with no software outside official repositories and with these steps:

  1. optionally tweak HDMI settings in /boot/config.txt
  2. add touchscreen overlay settings in /boot/config.txt
  3. uninstall xserver-xorg-input-all and xserver-xorg-input-libinput
  4. install xserver-xorg-input-evdev
  5. copy usr/99-calibration.conf-35 (this repo) into /etc/X11/xorg.conf.d/99-calibration.conf
  6. tweak 99-calibration.conf manualy or with xinput_calibrator
  7. be happy
maxiu1 commented 6 years ago

@slavkoja my friend, after few days of google abuse i found your post here and i want to THANK YOU! This way i finally have working and calibrated touch display for Repetier Server!