Jump to content

Recommended Posts

Posted

Hey.

I'm working on getting a small touch screen working on my OPiZ+2.

It's a Waveshare 4.3 with a resistive touchpanel (using HDMI for displaying).

I've had some issues getting the touch panel to work, and just wanted to share my findings, and ask whether I have misunderstood something.

 

The waveshare wiki does provide a script for setting up the panel, but I think it's more aimed at a raspberry pi, and it didn't get the touch panel working.

 

I manually added spi-spidev and spi-add-cs1 to to armbianEnv.txt.

I also added the parameters:

param_spidev_spi_bus=1

param_spidev_spi_cs=1

(took me a bit to figure out that I had to use spi1 instead of spi0, but so far so good).

I also made a dts for the touchpanel chip - ads7846.dts: (using PA2 - never mind where it says PA7)

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

	fragment@0 {
		target = <&pio>;
		__overlay__ {
			ads7846_pins: ads7846_pins {
				pins= "PA2";
				function = "irq";
           		};
		};
	};

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

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

 

 

Anyways, I still could not get the touch to work.

After many hours of messing around, I found an image of the pins on the orange pi zero here:

Orange-Pi-Zero-Pinout.jpg&f=1&nofb=1

which seems to indicate that SPI_CS is on pin PA13 - not PA10.......

The connector on the display has the CS connection on pin nr. 26.....

So I tried using wires between the OPi and the display connector, using pin nr. 24 (PA13) instead, and touch came to life!

So far so good - but does this mean I'm doing something wrong? Looking through the dts overlays, it seems that it SHOULD be PA10 for the SPI_CS....??

IS it possible to get the board to use PA10 instead of PA13, so I can connect the display directly on the board??

 

Regards

Anders.

 

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

Important Information

Terms of Use - Privacy Policy - Guidelines