Jump to content

Orange Pi Zero + 3.5" TFT Touchscreen


Recommended Posts

Hey :)
I followed the instructions on this page: https://kaspars.net/blog/linux/spi-display-orange-pi-zero

But I can't get my 3.5" TFT Touchscreen work: https://aliexpress.com/item/3-5-3-5-Zoll-TFT-LCD-Touchscreen-320x480-SPI-RGB-Display-Board-F-r-Raspberry/32834124804.html

I’ve got an Orange Pi Zero with armbian (ubuntu with legacy kernel).

I only see the backlight LED is working (white screen).

On kaspars blog everything looks so easy.

I hope someone can help me with my problem.
Thank you in advance guys!

Link to comment
Share on other sites

First, you are using a 3.5 inch display, and I can't see the pinout on it from your link but I assume it's similar or excact same as the ones I bought ( https://www.aliexpress.com/item/3-5-Inch-TFT-LCD-Moudle-For-Raspberry-Pi-2-Model-B-RPI-B-raspberry-pi/32707058182.html?spm=a2g0s.9042311.0.0.W6hSqE ) - You need reset:2;dc:71 instead of 3 and 0 in that case.

 

Also if you are using a newer image, something have changed since that guide.  I had some troubles getting mine working also.

 

This guide worked on my newer images. Very similar to the old procedure but few changes,  I spent a few days fumbling around untill I realized name had to be "piscreen". But worked out of the box. I only tested on OPI Lites though, but if it's a H3 zero it should work the same I guess... Haven't used mine in a while, or a lot for that matter. Anyway I used your linked guide also to get 3.2 inch screens working a while back but since I got 3.5's I haven't used it. The guide worked for them on lite also, and afaik pinouts is the same on H2+ also.

 

Link to comment
Share on other sites

@Blast thanks for your answer

 

I switched to the mainline kernel and got the Waveshare 3.5" (bought one to test it with an original) working with the following configs:

/boot/armbianEnv.txt  

overlays=spi-spidev spi-add-cs1
param_spidev_spi_bus=1
param_spidev_spi_cs=1

For me it only works with with param_spidev_spi_bus=1
When I try  param_spidev_spi_bus=0 or comment this parameter out, I get this error message on dmesg:

Quote

fbtft_device: spi_busnum_to_master(0) returned NULL

 

/etc/modules-load.d/fbtft.conf 

 

fbtft
fbtft_device

 

 

/etc/modprobe.d/fbtft.conf

 

options fbtft_device rotate=90 name=piscreen speed=16000000 busnum=1 gpios=reset:2,dc:18 txbuflen=32768 fps=25

Here the same, I can only get the display working with: busnum=1, every other parameter or deleting this parameter let the screen white and I get the same error message like above.
And the gpio 18 for dc is also only working on my Orange Pi Zero, cause its the right pin.

 

So far so good, the Display works.
But my big problem is getting touch work, the ads7846 is inside the Waveshare 3.5"

I tried the following user-overlays from @zador.blood.stained https://github.com/armbian/sunxi-DT-overlays/tree/master/examples
spi-double-spidev.dts
spi-ads7846.dts

 

I edited the spi-ads7846.dts like this:

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
	/*
	fragment@0 {
		target-path = "/aliases";
		__overlay__ {
			spi1 = "/soc/spi@01c69000";
		};
	};
	*/
		
	fragment@1 {
		target = <&pio>;
		__overlay__ {
			ads7846_pins: ads7846_pins {
				pins= "PA1";
				function = "irq";
				//bias-pull-up;
           		};
		};
	};

	fragment@2 {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			ads7846@0 {
				compatible = "ti,ads7846";
				reg = <1>; /* Chip Select 0 */
				status = "okay";
				pinctrl-names = "default";
				pinctrl-0 = <&ads7846_pins>;
				
				spi-max-frequency = <1600000>;
				interrupt-parent = <&pio>;
				interrupts = <0 1 2>; /* PA1 IRQ_TYPE_EDGE_FALLING */
				pendown-gpio = <&pio 0 1 0>; /* PA1 */

				/* driver defaults, optional */
				ti,x-min = /bits/ 16 <0>;
				ti,y-min = /bits/ 16 <0>;
				ti,x-max = /bits/ 16 <0x0FFF>;
				ti,y-max = /bits/ 16 <0x0FFF>;
				ti,pressure-min = /bits/ 16 <0>;
				ti,pressure-max = /bits/ 16 <0xFFFF>;
				ti,x-plate-ohms = /bits/ 16 <400>;
			};
		};
	};
};

 

Added the with the armbian-add-overlay command.
After a reboot the dmesg says the following:

 

Quote

dmesg | grep spi
[    4.220797] sun6i-spi 1c68000.spi: chipselect 0 already in use
[    4.220816] spi_master spi0: spi_device register error /soc/spi@01c68000/flash@0
[    4.220836] spi_master spi0: Failed to create SPI device for /soc/spi@01c68000/flash@0
[    4.222015] sun6i-spi 1c69000.spi: chipselect 1 already in use
[    4.222031] spi_master spi1: spi_device register error /soc/spi@01c69000/spidev
[    4.222048] spi_master spi1: Failed to create SPI device for /soc/spi@01c69000/spidev
[    7.801503] spi spi0.1: spidev spi0.1 1000kHz 8 bits mode=0x00
[    7.801516] spi spi0.0: spidev spi0.0 1000kHz 8 bits mode=0x00
[    7.801526] spi spi1.1: ads7846 spi1.1 1600kHz 8 bits mode=0x00
[    7.801854] spi spi0.1: spidev spi0.1 1000kHz 8 bits mode=0x00
[    7.801862] spi spi0.0: spidev spi0.0 1000kHz 8 bits mode=0x00
[    7.801871] spi spi1.1: ads7846 spi1.1 1600kHz 8 bits mode=0x00
[    7.801879] spi spi1.0: fb_ili9486 spi1.0 16000kHz 8 bits mode=0x00
[    9.598214] graphics fb0: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB buffer memory, fps=25, spi1.0 at 16 MHz
[    9.783259] ads7846 spi1.1: spi1.1 supply vcc not found, using dummy regulator
[    9.784569] ads7846 spi1.1: touchscreen, irq 49
[    9.785326] spidev spi0.1: probing from DT
[    9.787351] spidev spi0.0: probing from DT
[    9.808442] input: ADS7846 Touchscreen as /devices/platform/soc/1c69000.spi/spi_master/spi1/spi1.1/input/input0

 

For me it seems that the Touchscreen is detected by the spi, but I can't use it.
Neither if I tried some other IRQ pins like PA10 or PA7 or so.... If I look at the pinout, for me is the PA1 IRQ pin is right.

What did I wrong, can anybody help me please.
Trying it for days to get it work....

Kind regards

Kevin

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