Jump to content

GusAntoniassi

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by GusAntoniassi

  1. Hey @chwe, thanks for the detailed answer! I was having a hard time trying to understand the difference between mainlike and kernel, with their desktop / cli versions, but you explained it very clearly. I managed to get the display working after a while. I've detailed my steps in this thread. Thanks a lot for your help and attention!
  2. Some commands that might be useful for debugging: Running a program as a new window through SSH: DISPLAY=:0.0 {program name} Running the program as "full screen" (no desktop environment): First we need to find the executable path. You can find it with "whereis". I'll use "glxgears" to illustrate: whereis glxgears You'll get something like: The executable is usually in a "bin" folder. For glxgears the path is /usr/bin/glxgears. Now we can run the program with startx through the framebuffer we're using for the screen: FRAMEBUFFER=/dev/fb0 startx /usr/bin/glxgears
  3. Hey guys, I've spent the last couple of weeks trying to get a TFT display with touch screen to work on my Orange Pi PC board, and I've decided to share my step-by-step solution here. This tutorial is heavily based on Guide: How to use Touchscreen + LCD on H3 devices by Kutysam, but I had to do some extra steps for it to work properly. This tutorial is only for Mainline kernel, I was able to get the graphical screen working with Kutysam's guide for Legacy, but couldn't make the touch work. First of all this is the display I'm using: LCD module Pi TFT 3.5 inch (320*480) Touchscreen Display Module TFT for Raspberry Pi 3. I believe it is a clone of this Waveshare screen. Also, I am using the image Armbian_5.38_Orangepipc_Debian_stretch_next_4.14.14_desktop, but it should work for the headless version (server) too, if you install a display manager, desktop environment and the X server. All the commands below are assumed to be run as root user. If you're not root, add "sudo" to the beginning of each command. --- Preparation First of all make sure you have the latest package updates by running apt-get update && apt-get upgrade This might take a while. If the packages have been installed successfully, reboot. On a fresh install I was getting the following error message: If that happens to you, just run the command again and it should download everything properly. If it still isn't working you could try cleaning the apt cache. After that, install these Make prerequisites: apt-get install build-essentials For some reason the linux-headers package for sunxi is not included in the repository, this thread might explain it better than me. Either way, download and install the package with dpkg: wget http://apt.armbian.com/pool/main/l/linux-4.14.18-sunxi/linux-headers-next-sunxi_5.41_armhf.deb dpkg -i linux-headers-next-sunxi_5.41_armhf.deb Now we need to edit armbianEnv.txt to enable the overlays for spi and cs1 nano /boot/armbianEnv.txt Add the following lines to the end of the file (Be careful with spaces in the end of the lines... I lost a couple of days trying to figure out what the problem was when I had an extra space after "param_spidev_spi_bus=0" ) overlays=spi-spidev spi-add-cs1 param_spidev_spi_bus=0 param_spidev_spi_cs=1 And reboot. Screen Now we need to configure fbtft and fbtft_device on boot. Note: I had to put "98" in the start of the filename, or else I'd get the following error: "fbtft_device: spi_busnum_to_master(0) returned NULL" in dmesg after I installed the touchscreen. I believe it has something to do with the load order, so if you're having problems with this file you could try changing the prefix to 99 or removing it. nano /etc/modules-load.d/98-fbtft.conf Insert the following on the file: fbtft fbtft_device Now we have to load fbtft_device options on boot. Open the file with: nano /etc/modprobe.d/fbtft.conf Add the following: options fbtft_device rotate=90 name=piscreen speed=16000000 gpios=reset:2,dc:71 txbuflen=32768 fps=25 And reboot. At this point your screen should at least turn black. For me, the GUI wouldn't load unless I typed 'startx' on the console. So this is how I fixed it to always display the GUI on boot: apt-get install xserver-xorg-video-fbdev nano /usr/share/X11/xorg.conf.d/99-fbdev.conf Insert this in the file: Section "Device" Identifier "piscreen" Driver "fbdev" Option "fbdev" "/dev/fb0" EndSection At this point the screen should be displaying the Armbian GUI, with mouse and keyboard working, but without touch screen. Let's fix that. Touch First we need to download and compile the ads7846 driver (apparently it is compatible with xpt2046). mkdir ds7846 cd ds7846 wget https://sourceforge.net/p/openipmi/linux-ipmi/ci/master/tree/drivers/input/touchscreen/ads7846.c?format=raw mv ads7846.c?format=raw ads7846.c nano Makefile Insert the following on the makefile: obj-m := ads7846.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) all: $(MAKE) -C $(KDIR) M=$(PWD) modules clean: $(MAKE) -C $(KDIR) M=$(PWD) clean install: $(MAKE) -C $(KDIR) M=$(PWD) modules_install Now let's compile and load the module into the kernel: make make install depmod Now we'll build and install the ads7846_device module from fbtft_tools: cd .. git clone https://github.com/notro/fbtft_tools/ cd fbtft_tools/ads7846_device make make install depmod Let's load ads7846 and ads7846_device on boot sudo nano /etc/modules-load.d/99-ads7846.conf After that let's load the options for ads7846_device. These configs worked best for me, but you can play with them and tweak if needed. nano /etc/modprobe.d/ads7846_device.conf Insert the following: options ads7846_device model=7846 cs=1 gpio_pendown=1 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900 Reboot, and the touch should be working! Well, for me not entirely. The Y axis seemed to be reversed, so here are the steps I took to configure it: First of all, we need xinput to configure the touch screen options. Install it with this command: apt-get install xinput Now we need to set the "swap_xy" option to 0 in ads7846_device configuration file. Open it with: nano /etc/modprobe.d/ads7846_device.conf Replace its contents with this: options ads7846_device model=7846 cs=0 gpio_pendown=1 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900 Reboot to apply the changes. Now we need to find out the touchscreen name on xinput. Run this command: DISPLAY=:0.0 xinput list You should get a list of pointer devices, and the touchscreen should be on it. In my case the name is 'ADS7846 Touchscreen'. At this point you might get an "unable to connect to X server error". If that's the case, you can add the required X permissions for your user with the command (taken from this ask ubuntu answer): export XAUTHORITY=$(eval echo ~`who | grep tty7 | sed 's/\([a-z]*\).*/\1/'`)/.Xauthority And "xinput list" should be working. Now we can try to configure it with xinput's "set-prop" parameter: DISPLAY=:0.0 xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1 Test your display to see if it works. This matrix worked best for me, but you might need to tweak it. Refer to this guide for more info on how coordinate transformation matrices work. Now you need to run this command every time the session starts. To automate it, I added the command to the .xsessionrc file: nano /home/{your username}/.xsessionrc Append the xinput set-prop command: DISPLAY=:0.0 xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1 If you have multiple users logging in the session displayed on your screen, you might need to add this file for every user. ".xsessionrc" was the only file where I could get this working. And that's it! Your display + touch screen should be working properly now! I am still very newbie with Armbian and single board computers, and there is much I don't understand yet, so if you have any questions, comments or suggestions on this guide please post them below. See you all.
  4. Hey chwe, thanks for the replies! I will give Debian_stretch_next a try then when I have a little spare time. Just so I can understand, both Debian_stretch_next and Debian_stretch_next_desktop are mainline, the only difference being the GUI? I was under the impression that GUI images were legacy and CLI images were mainline. I'll post the results as soon as I have something!
  5. Isn't legacy Armbian_5.38_Orangepipc_Ubuntu_xenial_default_3.4.113_desktop ? That's what I got from the download page. In the box where the display came in there is a label that says "Driver: ILI9486", but from what I've seen this is a waveshare 3.5" display clone, and apparently it works with ADS7846 touch screen driver. The display itself worked with no problems by just configuring fbtft.
  6. Greetings all. I've bought an Orange Pi PC recently, along with this screen, and I wanted to make the touch screen work on it. I have tried following this tutorial and this one, but so far I was only able to get the screen working. Currently installed image is: Armbian_5.35_Orangepipc_Debian_jessie_default_3.4.113. When I run `evtest` the only devices detected are `vmouse`, `sunxi-gpiokey` and `sunxi-ths`. I tried installing a GUI with xorg, lightdm and xfce. To show the GUI on the display I am using the following command: FRAMEBUFFER=/dev/fb8 startx But touch still isn't working. This is the output of armbianmonitor -u: http://ix.io/18t5 This is my armbianEnv.txt: This is my orangepipc.fex And this is the output of `ls /dev/`. I believe there should be /dev/spi0.0 listed, but there isn't. I believe that is all. If I forgot to add some info please tell me and I'll try to get it right away. Thanks in advance for your attention.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines