Jump to content

Orange Pi Zero 2 - Custom DTS Overlay and GPIO Allocation conflicting with image DTS - All header pins pre-allocated for use - which ones are free to use?


Recommended Posts

Posted

I'm using image Armbian_23.8.3_Orangepizero2_bookworm_current_6.1.53

I'm building a DTS overlay for a SPI Touchscreen and every pin I try to use is showing this error:
 

[    1.441808] sun50i-h616-pinctrl 300b000.pinctrl: pin PC11 already requested by 5011000.spi; cannot claim for 300b000.pinctrl:75

[    1.441817] sun50i-h616-pinctrl 300b000.pinctrl: pin-75 (300b000.pinctrl:75) status -22

[    1.441829] sun6i-spi 5011000.spi: cannot register SPI master

 

I'm trying to configure my touchscreen dts to use the SPI1.0 & SPI1.1.  However, the pins exposed on the headers are all allocated for device use under 300b000.pinctrl.

How do you allocate header pins for another use?

 

I need 5 pins + SPI1 for the touchscreen to work.

 

My dts

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun8i-h3";

	fragment@0 {
		target = <&pio>;
		__overlay__ {
			spi1_cs1: spi1_cs1 {
				pins = "PC11"; 
				function = "gpio_out";
				output-high;
			};

			opiz_display_pins: opiz_display_pins {
				pins = "PC9", "PC6", "PC5";
				function = "gpio_out";
			};

			ads7846_pins: ads7846_pins {
				pins = "PH6";
				function = "irq";
			};
		};
	};

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

                        opizdisplay: opiz-display@0 {
                                reg = <0>; /* Chip Select 0 */
                                compatible = "ilitek,ili9341";
                                spi-max-frequency = <16000000>;
                                status = "okay";
                                pinctrl-names = "default";
                                pinctrl-0 = <&opiz_display_pins>;
                                rotate = <90>;
                                bgr = <0>;
                                fps = <10>;
                                buswidth = <8>;
                                dc-gpios = <&pio 2 6 0>;      /* PC6 */
                                reset-gpios = <&pio 2 9 1 >; /* PC9 */
                                led-gpios=<&pio 2 5 0>;      /*  PC5 */
                                debug=<0>;
                        };

			ads7846: ads7846@1 {
				reg = <1>; /* Chip Select 1 */
				compatible = "ti,ads7846";
				spi-max-frequency = <500000>;
				status = "okay";
				pinctrl-names = "default";
				pinctrl-0 = <&ads7846_pins>;
				interrupt-parent = <&pio>;
				interrupts = <7 6 2>; /* PH6 IRQ_TYPE_EDGE_FALLING */
				pendown-gpio = <&pio 7 6 0>; /* PH6 */
				/* 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>;
			};
		};

	};

};

 

Posted
14 часов назад, Peter Gregory сказал:

How do you allocate header pins for another use?

orange-pi-pc-hdmi-lcd-mpi3508-touchscreen-spi-move-cs-from-pin-24-to-pin-22

 

You have just set up this touchscreen display for another device. This is a fact.

See the schematic diagram for this new device.

Perhaps SPI1 is already divorced on the board and connected to the memory chip?

Use my suggestions and do it by analogy. I'm sure you can handle it.

Posted

Yeah, I think you are right.  I got the device working on an Orange PI PC, but I wanted a lower cost board with wifi.  I thought I could use the same technique to get the display working on my Orange PI Zero 2, but I couldn't find any pins I could use to drive the display.  The device tree allocated all the exposed pins for other uses.  Has anyone had luck getting a display like this one working on an Orange PI Zero W2 or similar hardware?

Posted

 

11 часов назад, Gunjan Gupta сказал:

@Peter GregoryAre you sure you are using the right pins? Based on the schematics, SPI1

@Gunjan Gupta You are, as always, the very courtesy!

Provided a link to the documentation.
From which follows:

h616-spi1-uart5-twi3.png

OPI-ZERO2-26-pin-connector.png

26 pins | pin name | function  |
-------------------------------|
  3     |    PH5   | spi1-cs0 ?|
 19     |    PH7   | spi1-mosi |
 21     |    PH8   | spi1-miso |
 23     |    PH6   | spi1-clk  |
 24     |    PH9   | spi1-cs0 ?|
 26     |    PC10  | spi1-cs1  |
-------------------------------

But this scheme says that the pins are divorced somewhere else. GPIO ASSIGNMENT (4)

PIN-other-function.png.7007010ca429d0da67674770f87bd94d.png

 

The first thing that came to my mind was to take a soldering iron in my hands and .....

 

 

Posted

Alternatively, you can use a driver to emulate SPI on free pins (spi-gpio), if this driver is available in the kernel.

This is a slow driver. But complete freedom.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines