I'm trying to get a HDMI LCD touchscreen working. The pinout is compatible with Orange PI PC except the SPI CS pin is on pin 26 (WPI 11) instead of pin 24 (WPI 10).
Is there an easy way to move the SPI CS pin to another GPIO pin? Also, I'm not sure how to properly configure the pen down interrupt pin for pin 22 (WPI 6)
So far, I've got the following working:
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Peter Gregory
I'm trying to get a HDMI LCD touchscreen working. The pinout is compatible with Orange PI PC except the SPI CS pin is on pin 26 (WPI 11) instead of pin 24 (WPI 10).
Is there an easy way to move the SPI CS pin to another GPIO pin? Also, I'm not sure how to properly configure the pen down interrupt pin for pin 22 (WPI 6)
So far, I've got the following working:
Image:
Orangepipc_2.0.8_debian_buster_desktop_linux5.4.65.7z
Touchscreen:
3.5 Inch HD HDMI USB LCD Touch Screen 3.5" Display Module 480×320 1920x1080 for Raspberry Pi 3rd 4th Generation 4B/3B+/3B/2B
orangepiEnv.txt:
overlays=spi-add-cs1 spi-spidev
param_spidev_spi_bus=0
param_spidev_spi_cs=0
Luckily, the kernel headers are loaded, so Makefile works.
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:
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
make
make install
depmod
cd ..
git clone https://github.com/notro/fbtft_tools/
cd fbtft_tools/ads7846_device
make
make install
depmod
cd ..
sudo nano /etc/modules-load.d/99-ads7846.conf
ads7846
ads7846_device
sudo nano /etc/modprobe.d/ads7846_device.conf
options ads7846_device model=7846 verbose=2 cs=0 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
after reboot, the SPI device is there and the touch driver attaches to the port.
[ 7.124454] ads7846_device: loading out-of-tree module taints kernel.
[ 7.125336]
ads7846_device: ads7846_device_init()
[ 7.125343] ads7846_device: SPI devices registered:
[ 7.125354] ads7846_device: spidev spi0.0 1000kHz 8 bits mode=0x00
[ 7.125357] ads7846_device:
[ 7.125366] ads7846_device: Settings:
[ 7.125369] ads7846_device: model = 7846
[ 7.125372] ads7846_device: gpio_pendown = 1
[ 7.125375] ads7846_device: swap_xy = 1
[ 7.125378] ads7846_device: x_min = 200
[ 7.125380] ads7846_device: x_max = 3900
[ 7.125383] ads7846_device: y_min = 200
[ 7.125386] ads7846_device: y_max = 3900
[ 7.125388] ads7846_device: x_plate_ohms = 60
[ 7.125391] ads7846_device: pressure_min = 0
[ 7.125393] ads7846_device: pressure_max = 255
[ 7.125396] ads7846_device: keep_vref_on = 1
[ 7.125398] ads7846_device: vref_delay_usecs = 0
[ 7.125401] ads7846_device: vref_mv = 0
[ 7.125403] ads7846_device: settle_delay_usecs = 0
[ 7.125406] ads7846_device: penirq_recheck_delay_usecs = 0
[ 7.125409] ads7846_device: y_plate_ohms = 0
[ 7.125411] ads7846_device: debounce_max = 0
[ 7.125414] ads7846_device: debounce_tol = 0
[ 7.125416] ads7846_device: debounce_rep = 0
[ 7.125425] ads7846_device: Deleting spi0.0
[ 7.126442] ads7846 spi0.0: spi0.0 supply vcc not found, using dummy regulator
[ 7.144047] ads7846 spi0.0: touchscreen, irq 65
[ 7.144980] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.0/input/input1
[ 7.145055] ads7846_device: SPI devices registered:
[ 7.145063] ads7846_device: ads7846 spi0.0 2000kHz 8 bits mode=0x00
[ 7.145066] ads7846_device:
Of course, no touch events are detected. Anyone else have any luck getting this to work?
I'm not familiar with changing the device tee to move GPIO pins, is there a configuration option for the spi_add_cs1?
Link to comment
Share on other sites
38 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.