Jump to content

Recommended Posts

Posted

Hey.

I'm trying to set up a 3.5" spi touch display with my orange pi zero +2 (H5). 
I've gotten the display to work - console is displaying fine, and the same with Xorg.
However, getting the touch panel to work, seems quite difficult. (I tested it on a pi, so I know the hardware works).
I've been running through all the threads I could find in here, regarding these setups, but I haven't been able to crack it.
I have tried a lot of different variations of using spi-spidev, spi-add-cs1, customized spi-double-spidev, setting the param_spidev_spi_bus etc.
I have a suspicion that something is off with the second cs channel, as this seems to be where I get my error regarding the touch panel:

anders@orangepizeroplus2-h5:~$ dmesg  | grep spi
[    5.412056] ads7846: probe of spi1.1 failed with error -22
[    5.425241] [drm] Initialized ili9486 1.0.0 20200118 for spi1.0 on minor 2
[    7.345854] ili9486 spi1.0: [drm] fb0: ili9486drmfb frame buffer device
anders@orangepizeroplus2-h5:~$

For now I'm trying to collect it all into one dts, since I pretty much had to edit all the others, to account for the pin naming on this board (https://linux-sunxi.org/Xunlong_Orange_Pi_Zero_Plus_2).

Here's my armbianEnv.txt:

 

verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun50i-h5
overlays=gpio-regulator-1.3v usbhost2 usbhost3
rootdev=UUID=9f2bef22-f83b-49fd-a7a8-02b905c6d123
rootfstype=ext4
user_overlays= tft35-4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

and the tft35-4.dts I've put together so far:

/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__ {
			spi0 = "/soc/spi@01c68000"; 
			spi1 = "/soc/spi@01c69000";
		};
	};

    	fragment@1 {
		target = <&pio>;
		__overlay__ {

			tft35a_pins: tft35a_pins {
				allwinner,pins = "PA18", "PA2";
				allwinner,function = "gpio_out";
			};

			ads7846_pins: ads7846_pins {
				pins = "PD11"; 
				function = "irq";
				pull = <0>;
			};

			spi1_cs1: spi1_cs1 {
				pins = "PD14";
				function = "gpio_out";
				output-high;
			};
		};
	};

	fragment@2 {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			pinctrl-names = "default", "default";
			pinctrl-1 = <&spi1_cs1>;
			cs-gpios = <1>, <&pio 3 14 0>; // PD14

			tft35a: tft35a@0 {
				reg = <0>; /* Chip Select 0 */
				compatible = "ilitek,ili9486";
				spi-max-frequency = <16000000>;
				status = "okay";
				pinctrl-names = "default";
				pinctrl-0 = <&tft35a_pins>;
				txbuflen = <32768>;
				rotation = <180>;
				bgr = <0>;
				fps = <25>;
				buswidth = <8>;
				regwidth = <16>;
				reset-gpios = <&pio 0 2 0>; //PA2
				dc-gpios = <&pio 0 18 0>; //PA18
				debug = <1>;
			};

			ads7846@1 {
				reg = <1>; /* Chip Select 1 */
				compatible = "ti,ads7846"; 
				spi-max-frequency = <2000000>;
				status = "okay";
				pinctrl-names = "default";
				interrupt-parent = <&pio>; 
				interrupts = <3 11 2>; //PD11
				pendown-gpio = <&pio 3 11 0>;

				/* 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>;
			};
		};
	};
};

 

Any help?

 

Regards

Anders

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

Important Information

Terms of Use - Privacy Policy - Guidelines