Jump to content

Running touchscreen 5 inch at xpt2046


Recommended Posts

Good day. I've purchased lcd 5'inch LCD.

I have some troubles with HDMI connection (no image), but i fixed it using this topic: link. (drivers at disk doesnt take any effect)

But i can not run touchpad. I used different hints but god no effect

board - Orange Pi PC Plus

kernel 3.4.113-sun8i

module  ads7846.ko at /lib/modules/3.4.113-sun8i/kernel/drivers/input/touchscreen

My script bin:

Spoiler

[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_cs0 = port:PA21<1><1><default><default>

[spi1]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PA13<2><1><default><default>
spi_sclk = port:PA14<2><default><default><default>
spi_mosi = port:PA15<2><default><default><default>
spi_miso = port:PA16<2><default><default><default>

[spi_devices]
spi_dev_num = 1

[spi_board0]
modalias = "ads7846"
max_speed_hz = 1500000
bus_num = 0
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0

I've glad to here any advice.

Снимок.PNG

Link to comment
Share on other sites

Hi

 

If you are using 3.4.113 kernel (source https://github.com/igorpecovnik/linux ), it is need to modify ads7846.c driver file. Here is info http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=444

I'v patched this file by hands, update kernel and driver ads7846.ko on board and it is works.

 

Here is the tool for kernel build https://github.com/armbian/build

Note you need ubuntu 16.04 x64

 

Attached ads7846.ko for 3.4.113  tested on Orange Pi One

Put it to /lib/modules/3.4.113-sun8i/kernel/drivers/input/touchscreen

If it is not loaded, also try 'modprobe ads7846.ko -f'

 

 

ads7846.ko

Link to comment
Share on other sites

@Mike R9FT

I am trying to enable touch for Waveshare 3.2 LCD with OPI one which has xpt2046 touch controller.

I am using Armbian_5.30_Orangepione_Ubuntu_xenial_default_3.4.113_desktop.

 

I didn't get with modifications required in the ads7846.c in the kernel source. Kindly guide me with the step by step procedure to modify the source file for waveshare 3.2 LCD.

LCD pin details http://www.waveshare.com/3.2inch-rpi-lcd-b.htm

Link to comment
Share on other sites

Hi

 

First of all you should build kernel from source. Here is a good guide https://docs.armbian.com/Developer-Guide_Build-Preparation/

I suggest you to use virtualbox with ubuntu 16.04 x64

 

Another quick way is to use already compiled https://forum.armbian.com/applications/core/interface/file/attachment.php?id=1209

Put it to /lib/modules/3.4.113-sun8i/kernel/drivers/input/touchscreen

 

Also you should update your configuration by using bin2fex and fex2bin utilities. See here https://docs.armbian.com/Hardware_Allwinner/.

Here is fex config adds:

[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_cs0 = port:PA21<1><1><default><default>

[spi_devices]
spi_dev_num = 1

[spi_board0]
modalias = "ads7846"
max_speed_hz = 1500000
bus_num = 0
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0

 

reboot,

load driver with modprobe ads7846.ko -f

 

calibrate with xinput_calibrator

 

Link to comment
Share on other sites

Hi,

 

As suggested, I have followed the following steps:

1. Pasted the pre-compiled touch driver ads7846.ko at /lib/modules/3.4.113-sun8i/kernel/drivers/input/touchscreen

2. Modified the /boot/script.bin with the suggested configuration changes for OPI one to enable touch "ads7846" module

3. Reboot

 

Post reboot when i run command sudo modprobe ads7846.ko -f, I am getting error "modprobe: FATAL: Module ads7846.ko not found in directory /lib/modules/3.4.113-sun8i"

Also I have checked the kernel logs, it shows :

 

[    3.996407] fbtft_device:  SPI devices registered:
[    3.996428] fbtft_device:      ads7846 spi0.0 1500kHz 8 bits mode=0x00
[    3.996439] fbtft_device:  'fb' Platform devices registered:
[    3.996511] fbtft_device: Deleting spi0.0
[    3.996697] fbtft_device:  GPIOS used by 'flexfb':
[    3.996707] fbtft_device:    'dc' = GPIO3
[    3.996715] fbtft_device:    'reset' = GPIO0
[    3.996722] fbtft_device:  SPI devices registered:
[    3.996733] fbtft_device:      flexfb spi0.0 3200kHz 8 bits mode=0x00

 

But touch is not working .. kindly suggest further

Link to comment
Share on other sites

3 hours ago, Sion said:

when i run command sudo modprobe ads7846.ko -f, I am getting error "modprobe: FATAL: Module ads7846.ko not found in directory /lib/modules/3.4.113-sun8i"

Try to run:

 

 depmod -a

 

This will add ads7846.ko module to modules.dep file (in the /lib/modules/3.4.113-sun8i directory), so modprobe should be able to load it.

Link to comment
Share on other sites

OK. Go to the /lib/modules/3.4.113-sun8i directory and check if modules.dep and modules.order contain record with the ads7846.ko module. If not, add the lines manually. You might need to run depmod once again.

Link to comment
Share on other sites

@sov1178

ads7846.ko enlisted in both the files

modules.dep

kernel/drivers/input/touchscreen/ads7846.ko:

 

modules.order

kernel/drivers/input/touchscreen/ads7846.ko

 

still modprobe command fails to load ads7846

Link to comment
Share on other sites

I also bought same HDMI Display module and able to run the display through OPI-Zero+2 HDMI Interface. But could not interface the touch screen over SPI1. This touch system uses XPT2046 / ADS7846 IC for touch interface over SPI communication. The problem is this module's touch interface has a manufacturing error. The XPT2046 is wrongly connected on the PCB.  As the datasheet described, the assembled IC is TSSOP package, But the connection is given depends on QFN package. I checked that OPI-Zero+2 is supplying the SPI data correctly, but the IC is not responding, then I checked the connection and found the error. I wasted a week suffering this error.

img051.png.d89975b5bbb0556f9cb6425fa3c9f2ef.png

Link to comment
Share on other sites

After 6 month of break i  have a little success.

So here is a result:  YT

As Khandoker Mazidul Haque told, there was a connection problem. To make device work connect CS pin and a pin nearby:

DSCN1763.thumb.JPG.b2e67fe737dabe6dc1bbb6cf2956d0a9.JPG

(i connected to IC, because i damaged CS pin)

After connection, install this driver: https://github.com/Tomasz-Mankowski/ADS7846-X11-daemon and calibrate touch

Crete file at your home dir: for ex autorun.sh and insert this: 

#!/bin/bash
sudo nohup /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11 --cfile /home/USER_NAME/ADS7846-X11-daemon/calibpoints.cal > /dev/null 2>&1 &

Edit sudoers to run driver without password:
 

USER_NAME ALL=(ALL) NOPASSWD: /home/USER_NAME/autorun.sh
USER_NAME ALL=(ALL) NOPASSWD: /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11
USER_NAME ALL= NOPASSWD: /home/USER_NAME/autorun.sh
USER_NAME ALL= NOPASSWD: /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11

Make autorun.sh excutable - chmod +x autorun.sh

To make driver work at startup add to rc.local line before "exit 0" 

sudo bash /home/vlad/autorun.sh

Save and reboot. Works on default script.bin

UPD: Tested these method Mike R9FT's post - works. Just edit script bin, copy .ko file and sudo modprobe ads7846.ko -f (or  sudo modprobe ads7846 -f)

 

Link to comment
Share on other sites

On 10/22/2017 at 5:49 PM, Ермаков Влад said:

After 6 month of break i  have a little success.

So here is a result:  YT

As Khandoker Mazidul Haque told, there was a connection problem. To make device work connect CS pin and a pin nearby:

DSCN1763.thumb.JPG.b2e67fe737dabe6dc1bbb6cf2956d0a9.JPG

(i connected to IC, because i damaged CS pin)

After connection, install this driver: https://github.com/Tomasz-Mankowski/ADS7846-X11-daemon and calibrate touch

Crete file at your home dir: for ex autorun.sh and insert this: 


#!/bin/bash
sudo nohup /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11 --cfile /home/USER_NAME/ADS7846-X11-daemon/calibpoints.cal > /dev/null 2>&1 &

Edit sudoers to run driver without password:
 


USER_NAME ALL=(ALL) NOPASSWD: /home/USER_NAME/autorun.sh
USER_NAME ALL=(ALL) NOPASSWD: /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11
USER_NAME ALL= NOPASSWD: /home/USER_NAME/autorun.sh
USER_NAME ALL= NOPASSWD: /home/USER_NAME/ADS7846-X11-daemon/ADS7846-X11

Make autorun.sh excutable - chmod +x autorun.sh

To make driver work at startup add to rc.local line before "exit 0" 


sudo bash /home/vlad/autorun.sh

Save and reboot. Works on default script.bin

UPD: Tested these method Mike R9FT's post - works. Just edit script bin, copy .ko file and sudo modprobe ads7846.ko -f (or  sudo modprobe ads7846 -f)

 

Great Job. Thank You.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines