Jump to content

Orange Pi Zero 3 GPIO


robertoj

Recommended Posts

Yesterday, I tried to use the digital IO in my opi zero3, with the Python GPIO package from https://opi-gpio.readthedocs.io/en/latest/ by Richard Hull

 

It depends on having sysfs files in /sys/class/gpio/

 

My original opi zero has these files and it works, but my opi zero3 doesn’t have these files

 

I learned that /sys/class/gpio is created if the linux kernel is configured with a specific option ON, as suggested in the documentation:

https://github.com/rm-hull/OPi.GPIO

https://linux-sunxi.org/GPIO 

 

Also, a developer has made a change on the opi.GPIO project to support opi zero3

https://github.com/rm-hull/OPi.GPIO/issues/79 

 

I will have time to try this tomorrow... but I want to ask: is anyone using GPIO in its most basic way?

 

As reference: I saw this older thread about zero3's GPIO... 

https://forum.armbian.com/topic/31493-how-to-enable-i2c3-on-orange-pi-zero-3/

 

It is using leebobby's "armbian" image, with raspi-config, and wiringpi

Using my original opi-zero, I never needed to use armbian-config to enable basic gpio and the python opi.gpio just worked as documented

 

Note: the opi.gpio only claims to support basic gpio, not i2c.

 

Update: these are interesting potential solutions and discussions (but they are all from before there was armbian for opiz3)

https://www.reddit.com/r/OrangePI/comments/16vfa4g/orange_pi_zero_3_gpio_python_library/

https://github.com/eutim/OPI.GPIO

https://www.reddit.com/r/OrangePI/comments/16ioyri/gpio_python_library_for_orange_pi_zero_3/

https://www.reddit.com/r/OrangePI/comments/18iveo3/how_to_control_gpio_pins_in_android_orange_pi/

 

Link to comment
Share on other sites

Thank you Gunjan... I hope i have the skill (or time to develop the skill) to add support for opiz3

 

In the older thread, I was told that /sys/class/gpio won't work anymore... well, it is very true:

https://forum.armbian.com/topic/29202-orange-pi-zero-3/?do=findComment&comment=180975

https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/

 

So, any methods and libraries that depend on sys/class/gpiolike opi.gpio, JUST WONT WORK

Link to comment
Share on other sites

MRAA doesn't depend on sysfs. Its intelligent enough to choose either that or /dev/gpiochip* device

 

Simpler method if you wish to try - https://github.com/eclipse/mraa/blob/master/docs/jsonplatform.md

Example file for the same - https://github.com/eclipse/mraa/blob/master/examples/platform/turbotjson.json

create json file, export MRAA_JSON_PLATFORM=<path_to_json_file> and you should have it working

Link to comment
Share on other sites

Ok. I got one output pin to work. 😀

 

This is how to do it in OrangePi Zero 3, pin 8 PH2:

 

image.thumb.png.62138b55398142cce2eca5bf1c894995.png

 

In Bash as root:

# addgroup --system gpio

# chown root:gpio /dev/gpiochip0

# chmod 660 /dev/gpiochip0

# nano /etc/udev/rules.d/61-gpio-tools.rules

{add line SUBSYSTEM=="gpio",KERNEL=="gpiochip*", GROUP="gpio", MODE="0660"}

# usermod -a -G gpio myusername

# apt install python3-dev

# reboot

 

In a new folder for your Python script, as normal user:

$ python3 -m venv .venv

$ source .venv/bin/activate

$ pip install gpiod

 

Create script (example in https://pypi.org/project/gpiod/ with one fix):

$ nano blink_pin.py
 

import time
import gpiod #needed in example
from gpiod.line import Direction, Value

#Calculating PH2 "line" number
#H=8
#2=2
#line=(8-1)x32+2=226
#also shown in https://github.com/rm-hull/OPi.GPIO/issues/79

LINE = 226
with gpiod.request_lines(
    "/dev/gpiochip0",
    consumer="blink-example",
    config={
        LINE: gpiod.LineSettings(
            direction=Direction.OUTPUT, output_value=Value.ACTIVE
        )
    },
) as request:
    while True:
        request.set_value(LINE, Value.ACTIVE)
        time.sleep(1)
        request.set_value(LINE, Value.INACTIVE)
        time.sleep(1)

 

Run script:

$ python3 blink_pin.py

 

When done working with your project:

$ deactivate

 

Pin 8 PH2 turns ON and OFF 😄

I haven't tested the other pins yet

Edited by robertoj
updated to add udev rule for gpio
Link to comment
Share on other sites

This thread inspired me to tinker with GPIO again. I was curious to see how I would realize the example for myself. Since python is not my strong point, I chose a poor man's solution with "dnf install libgpiod-utils".

I then ran this command:

gpioset --toggle 100ms,100ms,100ms,100ms,100ms,300ms,300ms,100ms,300ms,100ms,300ms,300ms,100ms,100ms,100ms,100ms,100ms,700ms --consumer panic con1-08=active

I'm wondering now what the flashing code could say, but I think a ham radio operator would know for sure what it means 😉
Recreating the python example wasn't really challenging with:

gpioset -t1000 -Cblink-example con1-08=1

And besides, I find my flashing pattern much more interesting. I would be interested to know how something like this would be implemented with sysfs. Certainly not with a one-liner.
These commands work the same way on all my different devices, i.e. it is used for all pin 8 of the first expansion connector. I find it more pleasant to address the pins with con1-xx than to deal with some device-specific gpio-lines again and again. Generated code is therefore portable and can be used on any device without modification, provided that the device can provide GPIO functionality on the corresponding pins.
The only requirement is that the same gpio-line-name is used for the corresponding GPIO of the extension port. But this can be ensured by a simple DTB overlay. Creating such an overlay is a one-time effort for any device and the first thing I do for a device that I care off.

Link to comment
Share on other sites

gpio-sysfs is deprecated and gpiod is one of the replacements

 

https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/

 

What would be needed to have my orangepi zero 3 show this?

VVV This is NOT what I get. This is what I want to get VVV
$ gpioinfo
gpiochip0 - 27 lines:
line 229: "PH5/I2C3_SDA" input
line 228: "PH4/I2C3_SCK" input
line 73 "PC9" input
line 226 "PH2/UART5_TX" output
line 227 "PH3/UART5_RX" input
line 70 "PC6" input
line 75 "PC11" input
line 69 "PC5" input
line 72 "PC8" input
line 79 "PC15" input
line 78 "PC14" input
line 231 "PH7,SPI1_MOSI" input
line 232 "PH8,SPI1_MISO" input
line 71 "PC7" input
line 230 "PH6,SPI1_CLK" input
line 233 "PH9,SPI1_CS" input
line 74 "PC10" input
line 234 "PH10/UART6_TX" input
line 235 "PH11/UART6_RX" input
line 236 "PH12/I2C4_SDA" input
line 237 "PH13/I2C4_SCK" input
line 238 "PH14/SPI2_MOSI" input
line 239 "PH15/SPI2_MISO" input
line 240 "PH16/SPI2_CLK" input
line 241 "PH17/SPI2_CS" input
line 242 "PH18/UART7_TX" input
line 243 "PH19/UART7_RX" input

 

Link to comment
Share on other sites

What should I do in my orangepi zero 3, so that the result of "gpioinfo " is "line 229: "PH5...", and just show the usable lines (as shown in https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/ )

 

What I get now is: "line 0: unnamed... (288 lines)" (as shown in https://forum.armbian.com/topic/29202-orange-pi-zero-3/?do=findComment&comment=181015)

 

Is this the way to do it? https://stackoverflow.com/questions/60100907/gpiod-use-labels-in-devicetree

 

 

Link to comment
Share on other sites

If that also shows the same output. The pin numbers starts from 0 for PA0 to 31 for PA31, 32 for PB0 to 63 for PB31 and so on until PI* lines. So basically there are 32 pins in each lines stacked together and lines are PA to PI making them 288 pins total on gpiochip 0. Then you have PL line on gpiochip1. You should see the names. If its not visible, then it is a bug in kernel pinctrl driver.

Link to comment
Share on other sites

@robertoj, all,

 

apparently, it may be possible to name the lines in the DTS

https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpio/gpiolib.c?h=v6.7.4#n456

 

Example:

gpio-controller@00000000 {
	compatible = "foo";
	reg = <0x00000000 0x1000>;
	gpio-controller;
	#gpio-cells = <2>;
	ngpios = <18>;
	gpio-reserved-ranges = <0 4>, <12 2>;
	gpio-line-names = "MMC-CD", "MMC-WP", "VDD eth", "RST eth", "LED R",
		"LED G", "LED B", "Col A", "Col B", "Col C", "Col D",
		"Row A", "Row B", "Row C", "Row D", "NMI button",
		"poweroff", "reset";

 

I'm not sure though if the gpio-line-names assignment can be used in pin-control devices that is currently present in the existing DTS.

 

note also that the line/pin functions are actually defined in the source codes for the pin-control driver, just that this won't automatically appear as gpio-line-names.

 

you may want to start experimenting, post your findings and perhaps make a PR?

 

note that there is another source tree to commit though , which is in linux-sunxi - that would be directly mainlining / upstreaming the changes.

https://linux-sunxi.org/Main_Page

https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/

they have a google groups here:

https://groups.google.com/g/linux-sunxi

https://linux-sunxi.org/Mailing_list

 

I'm not too sure about the procedure to commit changes in mainline though.

Link to comment
Share on other sites

Link to comment
Share on other sites

7 hours ago, robertoj said:

What would be needed to have my orangepi zero 3 show this?

As allredy stated, a quite simple DTB overlay. See this thread as an entry point for discussions that have already taken place on this topic.
More on gpio-line-names assignment can also be found in other posts of mine in this forum.
But after the last posts in this thread I have doubts whether I should continue to participate here. IMHO the basic knowledge seems to be lacking, but they think to know exactly what the solution should look like and don't accept any other implementation. Something like this has repeatedly led to inconclusive discussions, which I am no longer prepared to engage in.
If you'd like, I can try to walk you through creating a suitable overlay.
For a first step, I need the output of

cat /sys/kernel/debug/gpio

 from your running system and the DTB that is currently being used for your system. And last but not least, I need an online link to the DTB source of your device or is this already correct.

Link to comment
Share on other sites

11 hours ago, usual user said:

But after the last posts in this thread I have doubts whether I should continue to participate here. IMHO the basic knowledge seems to be lacking, but they think to know exactly what the solution should look like and don't accept any other implementation. Something like this has repeatedly led to inconclusive discussions, which I am no longer prepared to engage in.

You probably are misunderstanding my comment and intent here. I assumed that robertoj needed the pin number pin name mapping for development and gave an alternative way of finding the same using debugfs. Also my previous comment was simply an attempt of explaining how pin names gets populated in pinctrl directory in debugfs and if its not present in pinctrl directory in debugfs then it probably will be a bug in the pinctrl driver. Looks like both the my intent and what was conveyed is being misunderstood. I was only trying to help.

Link to comment
Share on other sites

18 hours ago, Gunjan Gupta said:

what is the output of 

sudo /bin/bash -c "cat /sys/kernel/debug/pinctrl/*/pinmux-pins"

Does that suffice?

 

Spoiler

roberto@orangepizero3:~$ sudo /bin/bash -c "cat /sys/kernel/debug/pinctrl/*/pinmux-pins"
[sudo] password for roberto:
Pinmux settings per pin
Format: pin (name): mux_owner|gpio_owner (strict) hog?
pin 0 (PA0): UNCLAIMED
pin 1 (PA1): UNCLAIMED
pin 2 (PA2): UNCLAIMED
pin 3 (PA3): UNCLAIMED
pin 4 (PA4): UNCLAIMED
pin 5 (PA5): UNCLAIMED
pin 6 (PA6): UNCLAIMED
pin 7 (PA7): UNCLAIMED
pin 8 (PA8): UNCLAIMED
pin 9 (PA9): UNCLAIMED
pin 10 (PA10): UNCLAIMED
pin 11 (PA11): UNCLAIMED
pin 12 (PA12): UNCLAIMED
pin 64 (PC0): device 5010000.spi function spi0 group PC0
pin 65 (PC1): UNCLAIMED
pin 66 (PC2): device 5010000.spi function spi0 group PC2
pin 67 (PC3): device 5010000.spi function spi0 group PC3
pin 68 (PC4): device 5010000.spi function spi0 group PC4
pin 69 (PC5): UNCLAIMED
pin 70 (PC6): UNCLAIMED
pin 71 (PC7): UNCLAIMED
pin 72 (PC8): UNCLAIMED
pin 73 (PC9): UNCLAIMED
pin 74 (PC10): UNCLAIMED
pin 75 (PC11): UNCLAIMED
pin 76 (PC12): GPIO 300b000.pinctrl:76
pin 77 (PC13): GPIO 300b000.pinctrl:77
pin 78 (PC14): UNCLAIMED
pin 79 (PC15): UNCLAIMED
pin 80 (PC16): GPIO 300b000.pinctrl:80
pin 96 (PD0): UNCLAIMED
pin 97 (PD1): UNCLAIMED
pin 98 (PD2): UNCLAIMED
pin 99 (PD3): UNCLAIMED
pin 100 (PD4): UNCLAIMED
pin 101 (PD5): UNCLAIMED
pin 102 (PD6): UNCLAIMED
pin 103 (PD7): UNCLAIMED
pin 104 (PD8): UNCLAIMED
pin 105 (PD9): UNCLAIMED
pin 106 (PD10): UNCLAIMED
pin 107 (PD11): UNCLAIMED
pin 108 (PD12): UNCLAIMED
pin 109 (PD13): UNCLAIMED
pin 110 (PD14): UNCLAIMED
pin 111 (PD15): UNCLAIMED
pin 112 (PD16): UNCLAIMED
pin 113 (PD17): UNCLAIMED
pin 114 (PD18): UNCLAIMED
pin 115 (PD19): UNCLAIMED
pin 116 (PD20): UNCLAIMED
pin 117 (PD21): UNCLAIMED
pin 118 (PD22): UNCLAIMED
pin 119 (PD23): UNCLAIMED
pin 120 (PD24): UNCLAIMED
pin 121 (PD25): UNCLAIMED
pin 122 (PD26): UNCLAIMED
pin 123 (PD27): UNCLAIMED
pin 124 (PD28): UNCLAIMED
pin 128 (PE0): UNCLAIMED
pin 129 (PE1): UNCLAIMED
pin 130 (PE2): UNCLAIMED
pin 131 (PE3): UNCLAIMED
pin 132 (PE4): UNCLAIMED
pin 133 (PE5): UNCLAIMED
pin 134 (PE6): UNCLAIMED
pin 135 (PE7): UNCLAIMED
pin 136 (PE8): UNCLAIMED
pin 137 (PE9): UNCLAIMED
pin 138 (PE10): UNCLAIMED
pin 139 (PE11): UNCLAIMED
pin 140 (PE12): UNCLAIMED
pin 141 (PE13): UNCLAIMED
pin 142 (PE14): UNCLAIMED
pin 143 (PE15): UNCLAIMED
pin 144 (PE16): UNCLAIMED
pin 145 (PE17): UNCLAIMED
pin 146 (PE18): UNCLAIMED
pin 147 (PE19): UNCLAIMED
pin 148 (PE20): UNCLAIMED
pin 149 (PE21): UNCLAIMED
pin 150 (PE22): UNCLAIMED
pin 160 (PF0): device 4020000.mmc function mmc0 group PF0
pin 161 (PF1): device 4020000.mmc function mmc0 group PF1
pin 162 (PF2): device 4020000.mmc function mmc0 group PF2
pin 163 (PF3): device 4020000.mmc function mmc0 group PF3
pin 164 (PF4): device 4020000.mmc function mmc0 group PF4
pin 165 (PF5): device 4020000.mmc function mmc0 group PF5
pin 166 (PF6): GPIO 300b000.pinctrl:166
pin 192 (PG0): device 4021000.mmc function mmc1 group PG0
pin 193 (PG1): device 4021000.mmc function mmc1 group PG1
pin 194 (PG2): device 4021000.mmc function mmc1 group PG2
pin 195 (PG3): device 4021000.mmc function mmc1 group PG3
pin 196 (PG4): device 4021000.mmc function mmc1 group PG4
pin 197 (PG5): device 4021000.mmc function mmc1 group PG5
pin 198 (PG6): UNCLAIMED
pin 199 (PG7): UNCLAIMED
pin 200 (PG8): UNCLAIMED
pin 201 (PG9): UNCLAIMED
pin 202 (PG10): UNCLAIMED
pin 203 (PG11): UNCLAIMED
pin 204 (PG12): UNCLAIMED
pin 205 (PG13): UNCLAIMED
pin 206 (PG14): UNCLAIMED
pin 207 (PG15): UNCLAIMED
pin 208 (PG16): UNCLAIMED
pin 209 (PG17): UNCLAIMED
pin 210 (PG18): GPIO 300b000.pinctrl:210
pin 211 (PG19): UNCLAIMED
pin 224 (PH0): device 5000000.serial function uart0 group PH0
pin 225 (PH1): device 5000000.serial function uart0 group PH1
pin 226 (PH2): UNCLAIMED
pin 227 (PH3): UNCLAIMED
pin 228 (PH4): UNCLAIMED
pin 229 (PH5): UNCLAIMED
pin 230 (PH6): UNCLAIMED
pin 231 (PH7): UNCLAIMED
pin 232 (PH8): UNCLAIMED
pin 233 (PH9): UNCLAIMED
pin 234 (PH10): UNCLAIMED
pin 256 (PI0): device 5020000.ethernet function emac0 group PI0
pin 257 (PI1): device 5020000.ethernet function emac0 group PI1
pin 258 (PI2): device 5020000.ethernet function emac0 group PI2
pin 259 (PI3): device 5020000.ethernet function emac0 group PI3
pin 260 (PI4): device 5020000.ethernet function emac0 group PI4
pin 261 (PI5): device 5020000.ethernet function emac0 group PI5
pin 262 (PI6): UNCLAIMED
pin 263 (PI7): device 5020000.ethernet function emac0 group PI7
pin 264 (PI8): device 5020000.ethernet function emac0 group PI8
pin 265 (PI9): device 5020000.ethernet function emac0 group PI9
pin 266 (PI10): device 5020000.ethernet function emac0 group PI10
pin 267 (PI11): device 5020000.ethernet function emac0 group PI11
pin 268 (PI12): device 5020000.ethernet function emac0 group PI12
pin 269 (PI13): device 5020000.ethernet function emac0 group PI13
pin 270 (PI14): device 5020000.ethernet function emac0 group PI14
pin 271 (PI15): device 5020000.ethernet function emac0 group PI15
pin 272 (PI16): device 5020000.ethernet function emac0 group PI16
Pinmux settings per pin
Format: pin (name): mux_owner|gpio_owner (strict) hog?
pin 352 (PL0): UNCLAIMED
pin 353 (PL1): UNCLAIMED

 

 

Link to comment
Share on other sites

@robertojI assumed you were looking for that pin name, number mapping for development. If so I hope that file will be helpful. If you still want the output to be in gpioinfo command, I guess you have to add the overlay as suggested by others. I personally don't use gpiod that much as I find it somewhat lacking. I last checked it in late 2022 or early 2023 I believe and it was only supporting simple gpio operations and was not supporting i2c, spi, etc. I am not sure it changed. But if its still the case and if you require to use more functionality, I will suggest going the MRAA route like I suggested before. 

Link to comment
Share on other sites

11 hours ago, usual user said:

For a first step, I need the output of

cat /sys/kernel/debug/gpio

 

roberto@orangepizero3:~$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-287, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-76  (                    |red:status          ) out hi 
 gpio-77  (                    |green:power         ) out hi 
 gpio-80  (                    |regulator-usb1-vbus ) out hi 
 gpio-166 (                    |cd                  ) in  lo ACTIVE LOW
 gpio-210 (                    |reset               ) out hi ACTIVE LOW

gpiochip1: GPIOs 352-383, parent: platform/7022000.pinctrl, 7022000.pinctrl:


Attaching DTB from /boot/dtb/allwinner/sun50i-h618-orangepi-zero3.dtb in rolling armbian release.

I dont know whether there are any armbian patches toward the GPIO, but this is the folder with armbian patches for orangepi zero 3

https://github.com/armbian/build/tree/main/patch/kernel/archive/sunxi-6.7/patches.armbian

sun50i-h618-orangepi-zero3.dtb

Link to comment
Share on other sites

12 minutes ago, Gunjan Gupta said:

@robertojI assumed you were looking for that pin name, number mapping for development. If so I hope that file will be helpful. If you still want the output to be in gpioinfo command, I guess you have to add the overlay as suggested by others. I personally don't use gpiod that much as I find it somewhat lacking. I last checked it in late 2022 or early 2023 I believe and it was only supporting simple gpio operations and was not supporting i2c, spi, etc. I am not sure it changed. But if its still the case and if you require to use more functionality, I will suggest going the MRAA route like I suggested before. 

Thank you... I already got the help that I personally needed to get my work project rolling again :)

I want to learn how to make a DTS, compile it into a DTBO and make a Pull Request

 

I agree that GPIOD is less capable than MRAA. I may have the time to learn how to make it work.

Link to comment
Share on other sites

11 hours ago, robertoj said:

sun50i-h618-orangepi-zero3.dtb 31.64 kB · 1 download

I've written an overlay that I think is correct. Since I don't have a Orange Pi Zero 3 I need your help to verify my work. Therefore I have applied my overlay staticly to your provided DTB. Please replace your existing DTB with the attached one. Reboot and post the "cat /sys/kernel/debug/gpio" output again.
If everything works as expected, I will post the overlay source and explain how to use it.

sun50i-h618-orangepi-zero3.dtb

Link to comment
Share on other sites

On 2/10/2024 at 12:11 AM, usual user said:

Please replace your existing DTB with the attached one. Reboot and post the "cat /sys/kernel/debug/gpio" output again.

 

With armbian's DTB. cat /sys/kernel/debug/gpio

root@orangepizero3:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-287, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-76  (                    |red:status          ) out lo 
 gpio-77  (                    |green:power         ) out hi 
 gpio-80  (                    |regulator-usb1-vbus ) out hi 
 gpio-166 (                    |cd                  ) in  lo ACTIVE LOW
 gpio-210 (                    |reset               ) out hi ACTIVE LOW

gpiochip1: GPIOs 352-383, parent: platform/7022000.pinctrl, 7022000.pinctrl:
root@orangepizero3:~#

 

With the DTB you created yesterday

root@orangepizero3:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-287, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-69  (con1-13             )
 gpio-70  (con1-11             )
 gpio-71  (con1-22             )
 gpio-72  (con1-15             )
 gpio-73  (con1-07             )
 gpio-74  (con1-26             )
 gpio-75  (con1-12             )
 gpio-76  (                    |red:status          ) out lo 
 gpio-77  (                    |green:power         ) out hi 
 gpio-78  (con1-18             )
 gpio-79  (con1-16             )
 gpio-80  (                    |regulator-usb1-vbus ) out hi 
 gpio-166 (                    |cd                  ) in  lo ACTIVE LOW
 gpio-210 (                    |reset               ) out hi ACTIVE LOW
 gpio-226 (con1-08             )
 gpio-227 (con1-10             )
 gpio-228 (con1-05             )
 gpio-229 (con1-03             )
 gpio-230 (con1-23             )
 gpio-231 (con1-19             )
 gpio-232 (con1-21             )
 gpio-233 (con1-24             )

gpiochip1: GPIOs 352-383, parent: platform/7022000.pinctrl, 7022000.pinctrl:
root@orangepizero3:~#

 

And, the result of gpioinfo is:

Spoiler

root@orangepizero3:~# gpioinfo
gpiochip0 - 288 lines:
    line   0:      unnamed       unused   input  active-high
    line   1:      unnamed       unused   input  active-high
    line   2:      unnamed       unused   input  active-high
    line   3:      unnamed       unused   input  active-high
    line   4:      unnamed       unused   input  active-high
    line   5:      unnamed       unused   input  active-high
    line   6:      unnamed       unused   input  active-high
    line   7:      unnamed       unused   input  active-high
    line   8:      unnamed       unused   input  active-high
    line   9:      unnamed       unused   input  active-high
    line  10:      unnamed       unused   input  active-high
    line  11:      unnamed       unused   input  active-high
    line  12:      unnamed       unused   input  active-high
    line  13:      unnamed       unused   input  active-high
    line  14:      unnamed       unused   input  active-high
    line  15:      unnamed       unused   input  active-high
    line  16:      unnamed       unused   input  active-high
    line  17:      unnamed       unused   input  active-high
    line  18:      unnamed       unused   input  active-high
    line  19:      unnamed       unused   input  active-high
    line  20:      unnamed       unused   input  active-high
    line  21:      unnamed       unused   input  active-high
    line  22:      unnamed       unused   input  active-high
    line  23:      unnamed       unused   input  active-high
    line  24:      unnamed       unused   input  active-high
    line  25:      unnamed       unused   input  active-high
    line  26:      unnamed       unused   input  active-high
    line  27:      unnamed       unused   input  active-high
    line  28:      unnamed       unused   input  active-high
    line  29:      unnamed       unused   input  active-high
    line  30:      unnamed       unused   input  active-high
    line  31:      unnamed       unused   input  active-high
    line  32:      unnamed       unused   input  active-high
    line  33:      unnamed       unused   input  active-high
    line  34:      unnamed       unused   input  active-high
    line  35:      unnamed       unused   input  active-high
    line  36:      unnamed       unused   input  active-high
    line  37:      unnamed       unused   input  active-high
    line  38:      unnamed       unused   input  active-high
    line  39:      unnamed       unused   input  active-high
    line  40:      unnamed       unused   input  active-high
    line  41:      unnamed       unused   input  active-high
    line  42:      unnamed       unused   input  active-high
    line  43:      unnamed       unused   input  active-high
    line  44:      unnamed       unused   input  active-high
    line  45:      unnamed       unused   input  active-high
    line  46:      unnamed       unused   input  active-high
    line  47:      unnamed       unused   input  active-high
    line  48:      unnamed       unused   input  active-high
    line  49:      unnamed       unused   input  active-high
    line  50:      unnamed       unused   input  active-high
    line  51:      unnamed       unused   input  active-high
    line  52:      unnamed       unused   input  active-high
    line  53:      unnamed       unused   input  active-high
    line  54:      unnamed       unused   input  active-high
    line  55:      unnamed       unused   input  active-high
    line  56:      unnamed       unused   input  active-high
    line  57:      unnamed       unused   input  active-high
    line  58:      unnamed       unused   input  active-high
    line  59:      unnamed       unused   input  active-high
    line  60:      unnamed       unused   input  active-high
    line  61:      unnamed       unused   input  active-high
    line  62:      unnamed       unused   input  active-high
    line  63:      unnamed       unused   input  active-high
    line  64:      unnamed       kernel   input  active-high [used]
    line  65:      unnamed       unused   input  active-high
    line  66:      unnamed       kernel   input  active-high [used]
    line  67:      unnamed       kernel   input  active-high [used]
    line  68:      unnamed       kernel   input  active-high [used]
    line  69:    "con1-13"       unused   input  active-high
    line  70:    "con1-11"       unused   input  active-high
    line  71:    "con1-22"       unused   input  active-high
    line  72:    "con1-15"       unused   input  active-high
    line  73:    "con1-07"  "interrupt"   input  active-high [used]
    line  74:    "con1-26"       unused   input  active-high
    line  75:    "con1-12"       unused   input  active-high
    line  76:      unnamed "red:status"  output  active-high [used]
    line  77:      unnamed "green:power" output active-high [used]
    line  78:    "con1-18"       unused   input  active-high
    line  79:    "con1-16"       unused   input  active-high
    line  80:      unnamed "regulator-usb1-vbus" output active-high [used]
    line  81:      unnamed       unused   input  active-high
    line  82:      unnamed       unused   input  active-high
    line  83:      unnamed       unused   input  active-high
    line  84:      unnamed       unused   input  active-high
    line  85:      unnamed       unused   input  active-high
    line  86:      unnamed       unused   input  active-high
    line  87:      unnamed       unused   input  active-high
    line  88:      unnamed       unused   input  active-high
    line  89:      unnamed       unused   input  active-high
    line  90:      unnamed       unused   input  active-high
    line  91:      unnamed       unused   input  active-high
    line  92:      unnamed       unused   input  active-high
    line  93:      unnamed       unused   input  active-high
    line  94:      unnamed       unused   input  active-high
    line  95:      unnamed       unused   input  active-high
    line  96:      unnamed       unused   input  active-high
    line  97:      unnamed       unused   input  active-high
    line  98:      unnamed       unused   input  active-high
    line  99:      unnamed       unused   input  active-high
    line 100:      unnamed       unused   input  active-high
    line 101:      unnamed       unused   input  active-high
    line 102:      unnamed       unused   input  active-high
    line 103:      unnamed       unused   input  active-high
    line 104:      unnamed       unused   input  active-high
    line 105:      unnamed       unused   input  active-high
    line 106:      unnamed       unused   input  active-high
    line 107:      unnamed       unused   input  active-high
    line 108:      unnamed       unused   input  active-high
    line 109:      unnamed       unused   input  active-high
    line 110:      unnamed       unused   input  active-high
    line 111:      unnamed       unused   input  active-high
    line 112:      unnamed       unused   input  active-high
    line 113:      unnamed       unused   input  active-high
    line 114:      unnamed       unused   input  active-high
    line 115:      unnamed       unused   input  active-high
    line 116:      unnamed       unused   input  active-high
    line 117:      unnamed       unused   input  active-high
    line 118:      unnamed       unused   input  active-high
    line 119:      unnamed       unused   input  active-high
    line 120:      unnamed       unused   input  active-high
    line 121:      unnamed       unused   input  active-high
    line 122:      unnamed       unused   input  active-high
    line 123:      unnamed       unused   input  active-high
    line 124:      unnamed       unused   input  active-high
    line 125:      unnamed       unused   input  active-high
    line 126:      unnamed       unused   input  active-high
    line 127:      unnamed       unused   input  active-high
    line 128:      unnamed       unused   input  active-high
    line 129:      unnamed       unused   input  active-high
    line 130:      unnamed       unused   input  active-high
    line 131:      unnamed       unused   input  active-high
    line 132:      unnamed       unused   input  active-high
    line 133:      unnamed       unused   input  active-high
    line 134:      unnamed       unused   input  active-high
    line 135:      unnamed       unused   input  active-high
    line 136:      unnamed       unused   input  active-high
    line 137:      unnamed       unused   input  active-high
    line 138:      unnamed       unused   input  active-high
    line 139:      unnamed       unused   input  active-high
    line 140:      unnamed       unused   input  active-high
    line 141:      unnamed       unused   input  active-high
    line 142:      unnamed       unused   input  active-high
    line 143:      unnamed       unused   input  active-high
    line 144:      unnamed       unused   input  active-high
    line 145:      unnamed       unused   input  active-high
    line 146:      unnamed       unused   input  active-high
    line 147:      unnamed       unused   input  active-high
    line 148:      unnamed       unused   input  active-high
    line 149:      unnamed       unused   input  active-high
    line 150:      unnamed       unused   input  active-high
    line 151:      unnamed       unused   input  active-high
    line 152:      unnamed       unused   input  active-high
    line 153:      unnamed       unused   input  active-high
    line 154:      unnamed       unused   input  active-high
    line 155:      unnamed       unused   input  active-high
    line 156:      unnamed       unused   input  active-high
    line 157:      unnamed       unused   input  active-high
    line 158:      unnamed       unused   input  active-high
    line 159:      unnamed       unused   input  active-high
    line 160:      unnamed       kernel   input  active-high [used]
    line 161:      unnamed       kernel   input  active-high [used]
    line 162:      unnamed       kernel   input  active-high [used]
    line 163:      unnamed       kernel   input  active-high [used]
    line 164:      unnamed       kernel   input  active-high [used]
    line 165:      unnamed       kernel   input  active-high [used]
    line 166:      unnamed         "cd"   input   active-low [used]
    line 167:      unnamed       unused   input  active-high
    line 168:      unnamed       unused   input  active-high
    line 169:      unnamed       unused   input  active-high
    line 170:      unnamed       unused   input  active-high
    line 171:      unnamed       unused   input  active-high
    line 172:      unnamed       unused   input  active-high
    line 173:      unnamed       unused   input  active-high
    line 174:      unnamed       unused   input  active-high
    line 175:      unnamed       unused   input  active-high
    line 176:      unnamed       unused   input  active-high
    line 177:      unnamed       unused   input  active-high
    line 178:      unnamed       unused   input  active-high
    line 179:      unnamed       unused   input  active-high
    line 180:      unnamed       unused   input  active-high
    line 181:      unnamed       unused   input  active-high
    line 182:      unnamed       unused   input  active-high
    line 183:      unnamed       unused   input  active-high
    line 184:      unnamed       unused   input  active-high
    line 185:      unnamed       unused   input  active-high
    line 186:      unnamed       unused   input  active-high
    line 187:      unnamed       unused   input  active-high
    line 188:      unnamed       unused   input  active-high
    line 189:      unnamed       unused   input  active-high
    line 190:      unnamed       unused   input  active-high
    line 191:      unnamed       unused   input  active-high
    line 192:      unnamed       kernel   input  active-high [used]
    line 193:      unnamed       kernel   input  active-high [used]
    line 194:      unnamed       kernel   input  active-high [used]
    line 195:      unnamed       kernel   input  active-high [used]
    line 196:      unnamed       kernel   input  active-high [used]
    line 197:      unnamed       kernel   input  active-high [used]
    line 198:      unnamed       unused   input  active-high
    line 199:      unnamed       unused   input  active-high
    line 200:      unnamed       unused   input  active-high
    line 201:      unnamed       unused   input  active-high
    line 202:      unnamed       unused   input  active-high
    line 203:      unnamed       unused   input  active-high
    line 204:      unnamed       unused   input  active-high
    line 205:      unnamed       unused   input  active-high
    line 206:      unnamed       unused   input  active-high
    line 207:      unnamed       unused   input  active-high
    line 208:      unnamed       unused   input  active-high
    line 209:      unnamed       unused   input  active-high
    line 210:      unnamed      "reset"  output   active-low [used]
    line 211:      unnamed       unused   input  active-high
    line 212:      unnamed       unused   input  active-high
    line 213:      unnamed       unused   input  active-high
    line 214:      unnamed       unused   input  active-high
    line 215:      unnamed       unused   input  active-high
    line 216:      unnamed       unused   input  active-high
    line 217:      unnamed       unused   input  active-high
    line 218:      unnamed       unused   input  active-high
    line 219:      unnamed       unused   input  active-high
    line 220:      unnamed       unused   input  active-high
    line 221:      unnamed       unused   input  active-high
    line 222:      unnamed       unused   input  active-high
    line 223:      unnamed       unused   input  active-high
    line 224:      unnamed       kernel   input  active-high [used]
    line 225:      unnamed       kernel   input  active-high [used]
    line 226:    "con1-08"       unused   input  active-high
    line 227:    "con1-10"       unused   input  active-high
    line 228:    "con1-05"       unused   input  active-high
    line 229:    "con1-03"       unused   input  active-high
    line 230:    "con1-23"       unused   input  active-high
    line 231:    "con1-19"       unused   input  active-high
    line 232:    "con1-21"       unused   input  active-high
    line 233:    "con1-24"       unused   input  active-high
    line 234:      unnamed       unused   input  active-high
    line 235:      unnamed       unused   input  active-high
    line 236:      unnamed       unused   input  active-high
    line 237:      unnamed       unused   input  active-high
    line 238:      unnamed       unused   input  active-high
    line 239:      unnamed       unused   input  active-high
    line 240:      unnamed       unused   input  active-high
    line 241:      unnamed       unused   input  active-high
    line 242:      unnamed       unused   input  active-high
    line 243:      unnamed       unused   input  active-high
    line 244:      unnamed       unused   input  active-high
    line 245:      unnamed       unused   input  active-high
    line 246:      unnamed       unused   input  active-high
    line 247:      unnamed       unused   input  active-high
    line 248:      unnamed       unused   input  active-high
    line 249:      unnamed       unused   input  active-high
    line 250:      unnamed       unused   input  active-high
    line 251:      unnamed       unused   input  active-high
    line 252:      unnamed       unused   input  active-high
    line 253:      unnamed       unused   input  active-high
    line 254:      unnamed       unused   input  active-high
    line 255:      unnamed       unused   input  active-high
    line 256:      unnamed       kernel   input  active-high [used]
    line 257:      unnamed       kernel   input  active-high [used]
    line 258:      unnamed       kernel   input  active-high [used]
    line 259:      unnamed       kernel   input  active-high [used]
    line 260:      unnamed       kernel   input  active-high [used]
    line 261:      unnamed       kernel   input  active-high [used]
    line 262:      unnamed       unused   input  active-high
    line 263:      unnamed       kernel   input  active-high [used]
    line 264:      unnamed       kernel   input  active-high [used]
    line 265:      unnamed       kernel   input  active-high [used]
    line 266:      unnamed       kernel   input  active-high [used]
    line 267:      unnamed       kernel   input  active-high [used]
    line 268:      unnamed       kernel   input  active-high [used]
    line 269:      unnamed       kernel   input  active-high [used]
    line 270:      unnamed       kernel   input  active-high [used]
    line 271:      unnamed       kernel   input  active-high [used]
    line 272:      unnamed       kernel   input  active-high [used]
    line 273:      unnamed       unused   input  active-high
    line 274:      unnamed       unused   input  active-high
    line 275:      unnamed       unused   input  active-high
    line 276:      unnamed       unused   input  active-high
    line 277:      unnamed       unused   input  active-high
    line 278:      unnamed       unused   input  active-high
    line 279:      unnamed       unused   input  active-high
    line 280:      unnamed       unused   input  active-high
    line 281:      unnamed       unused   input  active-high
    line 282:      unnamed       unused   input  active-high
    line 283:      unnamed       unused   input  active-high
    line 284:      unnamed       unused   input  active-high
    line 285:      unnamed       unused   input  active-high
    line 286:      unnamed       unused   input  active-high
    line 287:      unnamed       unused   input  active-high
gpiochip1 - 32 lines:
    line   0:      unnamed       unused   input  active-high
    line   1:      unnamed       unused   input  active-high
    line   2:      unnamed       unused   input  active-high
    line   3:      unnamed       unused   input  active-high
    line   4:      unnamed       unused   input  active-high
    line   5:      unnamed       unused   input  active-high
    line   6:      unnamed       unused   input  active-high
    line   7:      unnamed       unused   input  active-high
    line   8:      unnamed       unused   input  active-high
    line   9:      unnamed       unused   input  active-high
    line  10:      unnamed       unused   input  active-high
    line  11:      unnamed       unused   input  active-high
    line  12:      unnamed       unused   input  active-high
    line  13:      unnamed       unused   input  active-high
    line  14:      unnamed       unused   input  active-high
    line  15:      unnamed       unused   input  active-high
    line  16:      unnamed       unused   input  active-high
    line  17:      unnamed       unused   input  active-high
    line  18:      unnamed       unused   input  active-high
    line  19:      unnamed       unused   input  active-high
    line  20:      unnamed       unused   input  active-high
    line  21:      unnamed       unused   input  active-high
    line  22:      unnamed       unused   input  active-high
    line  23:      unnamed       unused   input  active-high
    line  24:      unnamed       unused   input  active-high
    line  25:      unnamed       unused   input  active-high
    line  26:      unnamed       unused   input  active-high
    line  27:      unnamed       unused   input  active-high
    line  28:      unnamed       unused   input  active-high
    line  29:      unnamed       unused   input  active-high
    line  30:      unnamed       unused   input  active-high
    line  31:      unnamed       unused   input  active-high
root@orangepizero3:~#

 

And the contents of pinmux-pins

Spoiler

root@orangepizero3:~# /bin/bash -c "cat /sys/kernel/debug/pinctrl/*/pinmux-pins"
Pinmux settings per pin
Format: pin (name): mux_owner|gpio_owner (strict) hog?
pin 0 (PA0): UNCLAIMED
pin 1 (PA1): UNCLAIMED
pin 2 (PA2): UNCLAIMED
pin 3 (PA3): UNCLAIMED
pin 4 (PA4): UNCLAIMED
pin 5 (PA5): UNCLAIMED
pin 6 (PA6): UNCLAIMED
pin 7 (PA7): UNCLAIMED
pin 8 (PA8): UNCLAIMED
pin 9 (PA9): UNCLAIMED
pin 10 (PA10): UNCLAIMED
pin 11 (PA11): UNCLAIMED
pin 12 (PA12): UNCLAIMED
pin 64 (PC0): device 5010000.spi function spi0 group PC0
pin 65 (PC1): UNCLAIMED
pin 66 (PC2): device 5010000.spi function spi0 group PC2
pin 67 (PC3): device 5010000.spi function spi0 group PC3
pin 68 (PC4): device 5010000.spi function spi0 group PC4
pin 69 (PC5): UNCLAIMED
pin 70 (PC6): UNCLAIMED
pin 71 (PC7): UNCLAIMED
pin 72 (PC8): UNCLAIMED
pin 73 (PC9): UNCLAIMED
pin 74 (PC10): UNCLAIMED
pin 75 (PC11): UNCLAIMED
pin 76 (PC12): GPIO 300b000.pinctrl:76
pin 77 (PC13): GPIO 300b000.pinctrl:77
pin 78 (PC14): UNCLAIMED
pin 79 (PC15): UNCLAIMED
pin 80 (PC16): GPIO 300b000.pinctrl:80
pin 96 (PD0): UNCLAIMED
pin 97 (PD1): UNCLAIMED
pin 98 (PD2): UNCLAIMED
pin 99 (PD3): UNCLAIMED
pin 100 (PD4): UNCLAIMED
pin 101 (PD5): UNCLAIMED
pin 102 (PD6): UNCLAIMED
pin 103 (PD7): UNCLAIMED
pin 104 (PD8): UNCLAIMED
pin 105 (PD9): UNCLAIMED
pin 106 (PD10): UNCLAIMED
pin 107 (PD11): UNCLAIMED
pin 108 (PD12): UNCLAIMED
pin 109 (PD13): UNCLAIMED
pin 110 (PD14): UNCLAIMED
pin 111 (PD15): UNCLAIMED
pin 112 (PD16): UNCLAIMED
pin 113 (PD17): UNCLAIMED
pin 114 (PD18): UNCLAIMED
pin 115 (PD19): UNCLAIMED
pin 116 (PD20): UNCLAIMED
pin 117 (PD21): UNCLAIMED
pin 118 (PD22): UNCLAIMED
pin 119 (PD23): UNCLAIMED
pin 120 (PD24): UNCLAIMED
pin 121 (PD25): UNCLAIMED
pin 122 (PD26): UNCLAIMED
pin 123 (PD27): UNCLAIMED
pin 124 (PD28): UNCLAIMED
pin 128 (PE0): UNCLAIMED
pin 129 (PE1): UNCLAIMED
pin 130 (PE2): UNCLAIMED
pin 131 (PE3): UNCLAIMED
pin 132 (PE4): UNCLAIMED
pin 133 (PE5): UNCLAIMED
pin 134 (PE6): UNCLAIMED
pin 135 (PE7): UNCLAIMED
pin 136 (PE8): UNCLAIMED
pin 137 (PE9): UNCLAIMED
pin 138 (PE10): UNCLAIMED
pin 139 (PE11): UNCLAIMED
pin 140 (PE12): UNCLAIMED
pin 141 (PE13): UNCLAIMED
pin 142 (PE14): UNCLAIMED
pin 143 (PE15): UNCLAIMED
pin 144 (PE16): UNCLAIMED
pin 145 (PE17): UNCLAIMED
pin 146 (PE18): UNCLAIMED
pin 147 (PE19): UNCLAIMED
pin 148 (PE20): UNCLAIMED
pin 149 (PE21): UNCLAIMED
pin 150 (PE22): UNCLAIMED
pin 160 (PF0): device 4020000.mmc function mmc0 group PF0
pin 161 (PF1): device 4020000.mmc function mmc0 group PF1
pin 162 (PF2): device 4020000.mmc function mmc0 group PF2
pin 163 (PF3): device 4020000.mmc function mmc0 group PF3
pin 164 (PF4): device 4020000.mmc function mmc0 group PF4
pin 165 (PF5): device 4020000.mmc function mmc0 group PF5
pin 166 (PF6): GPIO 300b000.pinctrl:166
pin 192 (PG0): device 4021000.mmc function mmc1 group PG0
pin 193 (PG1): device 4021000.mmc function mmc1 group PG1
pin 194 (PG2): device 4021000.mmc function mmc1 group PG2
pin 195 (PG3): device 4021000.mmc function mmc1 group PG3
pin 196 (PG4): device 4021000.mmc function mmc1 group PG4
pin 197 (PG5): device 4021000.mmc function mmc1 group PG5
pin 198 (PG6): UNCLAIMED
pin 199 (PG7): UNCLAIMED
pin 200 (PG8): UNCLAIMED
pin 201 (PG9): UNCLAIMED
pin 202 (PG10): UNCLAIMED
pin 203 (PG11): UNCLAIMED
pin 204 (PG12): UNCLAIMED
pin 205 (PG13): UNCLAIMED
pin 206 (PG14): UNCLAIMED
pin 207 (PG15): UNCLAIMED
pin 208 (PG16): UNCLAIMED
pin 209 (PG17): UNCLAIMED
pin 210 (PG18): GPIO 300b000.pinctrl:210
pin 211 (PG19): UNCLAIMED
pin 224 (PH0): device 5000000.serial function uart0 group PH0
pin 225 (PH1): device 5000000.serial function uart0 group PH1
pin 226 (PH2): UNCLAIMED
pin 227 (PH3): UNCLAIMED
pin 228 (PH4): UNCLAIMED
pin 229 (PH5): UNCLAIMED
pin 230 (PH6): UNCLAIMED
pin 231 (PH7): UNCLAIMED
pin 232 (PH8): UNCLAIMED
pin 233 (PH9): UNCLAIMED
pin 234 (PH10): UNCLAIMED
pin 256 (PI0): device 5020000.ethernet function emac0 group PI0
pin 257 (PI1): device 5020000.ethernet function emac0 group PI1
pin 258 (PI2): device 5020000.ethernet function emac0 group PI2
pin 259 (PI3): device 5020000.ethernet function emac0 group PI3
pin 260 (PI4): device 5020000.ethernet function emac0 group PI4
pin 261 (PI5): device 5020000.ethernet function emac0 group PI5
pin 262 (PI6): UNCLAIMED
pin 263 (PI7): device 5020000.ethernet function emac0 group PI7
pin 264 (PI8): device 5020000.ethernet function emac0 group PI8
pin 265 (PI9): device 5020000.ethernet function emac0 group PI9
pin 266 (PI10): device 5020000.ethernet function emac0 group PI10
pin 267 (PI11): device 5020000.ethernet function emac0 group PI11
pin 268 (PI12): device 5020000.ethernet function emac0 group PI12
pin 269 (PI13): device 5020000.ethernet function emac0 group PI13
pin 270 (PI14): device 5020000.ethernet function emac0 group PI14
pin 271 (PI15): device 5020000.ethernet function emac0 group PI15
pin 272 (PI16): device 5020000.ethernet function emac0 group PI16
Pinmux settings per pin
Format: pin (name): mux_owner|gpio_owner (strict) hog?
pin 352 (PL0): UNCLAIMED
pin 353 (PL1): UNCLAIMED
root@orangepizero3:~#

 

Link to comment
Share on other sites

Ok, everything is as expected.
So attached is the overlay source as promised and here is how to use it:
To avoid path information in the commands, I use

cd /boot/dtb/allwinner/

as the working directory.
To compile the overlay, execute:

dtc --in-format dts sun50i-h618-orangepi-zero3-con1.dtso --out sun50i-h618-orangepi-zero3-con1.dtbo

This is an one-off action that has only to be repeated when the overlay source changes.
To apply the overlay statically, execute:

mv sun50i-h618-orangepi-zero3.dtb sun50i-h618-orangepi-zero3-native.dtb
fdtoverlay --input sun50i-h618-orangepi-zero3-native.dtb --output sun50i-h618-orangepi-zero3-con1.dtb sun50i-h618-orangepi-zero3-con1.dtbo
ln -s sun50i-h618-orangepi-zero3-con1.dtb sun50i-h618-orangepi-zero3.dtb

By modifying the symlink, you can now easily switch between both or possibly multiple pre-build variants of DTBs, regardless of which overlay application method your system provides or not.
If you don't want pre-built variant support, an in-place application is also possible with:

fdtoverlay --input sun50i-h618-orangepi-zero3.dtb --output sun50i-h618-orangepi-zero3.dtb sun50i-h618-orangepi-zero3-con1.dtbo

The application of the overlay must always be repeated if the base DTB changes (update). I've attached this feature to my kernel build process so I don't have to worry about it. The kernel install process is also an option to apply local overlays permanently.

Of course, you can also use your OS's overlay application system.
If you want to modify the label names, use my *.dtso as a template and choose a new overlay filename. In this way, both variants can exist at the same time and you can choose as you wish.
Since this overlay only modifies one property value, it can even be applied repeatedly. I.e. with:

fdtoverlay --input sun50i-h618-orangepi-zero3.dtb --output sun50i-h618-orangepi-zero3.dtb sun50i-h618-orangepi-zero3-my-labels.dtbo

you can simply rewrite the property without any further necessary actions.
I'm sorry that my method doesn't require patches or even rebuilding the entire OS and works in every system from userspace that has the DTC software package installed and the firmware get the DTB provided from the userspace (filesystem) for loading.
Any system administrator should be able to execute the commands (either symlink adjustment or overlay application) from a running system and activate the changes by rebooting.

sun50i-h618-orangepi-zero3-con1.dtso

Link to comment
Share on other sites

usual user,

 

I compiled the "con1" dtso you provided, but I didn't integrate it in the whole SBC dtb. I left it as a dtbo and copied it to the user overlays... it worked and I have the opiz3 gpio pins named 😄

 

As a reminder, here's how to do it:

 

{start with a fresh armbian OS, or make sure that the orangepizero3 dtb is the original}
# cat /sys/kernel/debug/gpio
{check that the GPIO pins are not named}
{copy the dtso to /boot/user-overlays}
# dtc --in-format dts sun50i-h618-orangepi-zero3-con1.dtso --out sun50i-h618-orangepi-zero3-con1.dtbo
# ls -l
total 8
-rw-r--r-- 1 root    root     591 Feb 18 01:35 sun50i-h618-orangepi-zero3-con1.dtbo
-rw-r--r-- 1 root    root    1374 Feb 17 22:36 sun50i-h618-orangepi-zero3-con1.dtso
# nano /boot/armbianEnv.txt
{add line: user_overlays=sun50i-h618-orangepi-zero3-con1}
# reboot
# cat /sys/kernel/debug/gpio
{the gpio pins are named}

 

I was expecting it that the user overlays appear in the armbian-config utility... but my dtbo didnt show in the system>hardware selection options... is this normal?

 

To any newbie trying this: be careful of conflicts in activating a kernel-provided overlay and a user overlay at the same time:

https://docs.armbian.com/User-Guide_Allwinner_overlays/

 

I just noticed that there's a February 15 linux image... I will try that :)

 

Update... the compiled dtso did not work for the new linux OS image... uboot could not overlay the dtbo

Spoiler

250 bytes read in 2 ms (122.1 KiB/s)
32756 bytes read in 7 ms (4.5 MiB/s)
Working FDT set to 4fa00000
Failed to load '/boot/overlay-user/sun50i-h618-orangepi-zero3-con1.dtbo'
4203 bytes read in 6 ms (683.6 KiB/s)
Applying kernel provided DT fixup script (sun50i-h616-fixup.scr)
## Executing script at 45000000
18987263 bytes read in 789 ms (22.9 MiB/s)
23365640 bytes read in 969 ms (23 MiB/s)
Moving Image from 0x40080000 to 0x40200000, end=418d0000
## Loading init Ramdisk from Legacy Image at 4ff00000 ...
   Image Name:   uInitrd

and I noticed that it uses a different dtb... what should I do to update the dtso and make it work?

sun50i-h618-orangepi-zero3.dtb

 

HOWEVER: the DTSO works when applying it in the DTB, as you suggested. It is only when trying to apply the DTBO with uboot, it fails.

Unfortuately, the linux os freezes after 10 minutes or so  nevermind... it maybe another cause...

 

Link to comment
Share on other sites

7 hours ago, robertoj said:

I didn't integrate it in the whole SBC dtb. I left it as a dtbo and copied it to the user overlays

A perfectly legitimate method, but not always available:

 

7 hours ago, robertoj said:

https://docs.armbian.com/User-Guide_Allwinner_overlays/#armbian-specific-notes
Armbian specific notes
DT overlays are a Work-in-Progress (WIP) feature, present only in certain images.
Please note that different SoCs will have different sets of available overlays.

 

7 hours ago, robertoj said:
{check that the GPIO pins are not named}

This is not necessary, an overlay is just an overlay that overlays what already exists. Run the command "fdtoverlay..." three times in a row, keep DTB backups each time and compare them at last.

 

7 hours ago, robertoj said:

I was expecting it that the user overlays appear in the armbian-config utility... but my dtbo didnt show in the system>hardware selection options... is this normal?

This is a question for the one who came up with the overlay application method.

 

7 hours ago, robertoj said:

be careful of conflicts in activating a kernel-provided overlay and a user overlay at the same time

Mainline kernel usually doesn't come with overlays, they are usually added by the Armbian build system. My method should also work in combination.

 

7 hours ago, robertoj said:

Failed to load '/boot/overlay-user/sun50i-h618-orangepi-zero3-con1.dtbo'

Judging by the failure message, the overlay can't be found.

 

7 hours ago, robertoj said:

HOWEVER: the DTSO works when applying it in the DTB, as you suggested. It is only when trying to apply the DTBO with uboot, it fails.

You have thus proven that there is nothing wrong with the base DTB and the DTBO. It is to blame the tool (method) that is used to apply the overlay.
Dynamic application of overlays at boot time is only necessary if the firmare can automatically detect the need to apply an overlay by reading hardware identifiers. This is a method inherited from the Raspberry Pi and has its justification with its expansion modules with hardware identifier.
Using a configuration file (armbianEnv.txt) is just another way of statically selecting overlays and basically the same procedure as my method. I understand that overpaid Armbian developers implement something like this method out of boredom for devices that don't need it and then dynamically apply the statically selected overlays. But I prefer to rely on tools (fdtoverlay) that are more mature. After all, it's used in every kernel build (it's part of the kernel sources)  and maintained by the mainline Devicetree developers. And if something didn't work with it, it would immediately stand out and also be repaired. Because kernels are very rarely built 😉

Link to comment
Share on other sites

19 hours ago, robertoj said:

I was expecting it that the user overlays appear in the armbian-config utility... but my dtbo didnt show in the system>hardware selection options... is this normal?

It depends on what you mean by normal.  Currently the OVERLAY_PREFIX for this board is set to: OVERLAY_PREFIX="sun50i-h616" as the overlays are currently being shared between the h616 and h618.  So if you rename the overlay with that prefix it should be picked up by armbian-config.

Link to comment
Share on other sites

7 hours ago, SteeMan said:

the overlays are currently being shared between the h616 and h618.

Overlays are always device-specific, and in most cases, even use-case-specific.
Trying to share between different devices takes a huge amount of maintenance as opposed to a simple copy of a similar overlay. All possible interactions have to be taken into account and expecting NOOB users to understand their dependencies is asking for trouble. And if they do have to be different later, it is even more difficult to sort them apart.
And besides, what advantage does it bring to the user, since all Armbian images only address one specific device at a time?

Link to comment
Share on other sites

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