DietPi + Odroid n2+ UART not working - how to enable?

Indeed that is true. It is made for the Hardkernel UART adapter which fits this connector: https://www.hardkernel.com/shop/usb-uart-2-module-kit-copy/

Cam you check:

ls -al /dev/ttyAML* /dev/ttyS*

image

image

no change

and file:

rootdev=UUID=81343031-b96f-416b-969a-d8561349d3e4
rootfstype=ext4
# The init system logs to the console defined last.
consoleargs=console=tty1 console=ttyS0,115200 console=ttyS1,115200 console=ttyS2,115200 console=ttyS3,115200 console=ttyAML0,115200 console=ttyS7,115200 console=ttyS6,115200 console=ttyS4,115200 console=ttyS5,115200
verbosity=4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
extraargs=net.ifnames=0
docker_optimizations=off
overlay_path=amlogic
overlay_prefix=meson
overlays=uartA uartC
user_overlays= 

Okay, sadly seems those overlays are either broken or do not work in Odroid N2. Since it fits the case, I explained the situations with those overlays provided by Armbian in general here: Why is hardware peripherals setup / config (e.g. using device tree overlay) hidden from view - #7 by MichaIng

I’ll however test/verify this on my Odroid N2+ and see whether it can be trivially fixed, respectively whether there is a simple functional status toggle for UART1.

For my own reference, here is the Armbian patch to add those overlays: build/general-meson64-overlays.patch at e33842ef2c2fefecbcd7c14724c0cff5250cd34a · armbian/build · GitHub

diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts
new file mode 100644
index 000000000000..3aecd60aaf64
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+    compatible = "amlogic,meson-gxbb";
+    fragment@0 {
+	target-path = "/soc/bus@c1100000/serial@84c0";
+        __overlay__ {
+            status = "okay";
+        };
+    };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts
new file mode 100644
index 000000000000..2b40ee4c02d3
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+    compatible = "amlogic,meson-gxbb";
+    fragment@0 {
+	target-path = "/soc/bus@c1100000/serial@8700";
+        __overlay__ {
+            status = "okay";
+        };
+    };
+};

So we need to check whether /proc/device-tree/soc/bus@c1100000/serial@84c0/status and /proc/device-tree/soc/bus@c1100000/serial@8700/status still exist or whether something changed about this with recent Linux.

Hi, thank you for your answer. Question from my side is, what to do to get working again (before update/upgrade) it was working. For me (as quite newby) it’s not clear.

Or, is there any way to install “old” dietpi version and disable dietpi upgrade which is disaster for me?

If you need some tests, please write me.

Thanks

edit: is a solution use a user overlay described here ?
https://dietpi.com/forum/t/enabling-uart-on-odroid-n2/13754/4

edit2:
tried this:


but really not sure if instruction is correct

Did you had a chance to test it ? Any idea how to solve ?
Thank you

The two devices indeed do not exist. Instead:

root@OdroidN2:~# cat /proc/device-tree/soc/bus@ff800000/serial@3000/status
okay
root@OdroidN2:~# cat /proc/device-tree/soc/bus@ff800000/serial@4000/status
disabled
root@OdroidN2:~# l /proc/device-tree/aliases/
total 0
-r--r--r-- 1 root root 23 Jan  1  1970 ethernet0
-r--r--r-- 1 root root 17 Jan  1  1970 mmc0
-r--r--r-- 1 root root 18 Jan  1  1970 mmc1
-r--r--r-- 1 root root 17 Jan  1  1970 mmc2
-r--r--r-- 1 root root  8 Jan  1  1970 name
-r--r--r-- 1 root root 35 Jan  1  1970 rtc0
-r--r--r-- 1 root root 25 Jan  1  1970 rtc1
-r--r--r-- 1 root root 30 Jan  1  1970 serial0
root@OdroidN2:~# cat /proc/device-tree/aliases/serial0
/soc/bus@ff800000/serial@3000

So the first is ttyAML0 and the second most likely ttyAML1. There are even more if needed:

root@OdroidN2:~# l /proc/device-tree/soc/bus@ffd00000/serial*
serial@22000/ serial@23000/ serial@24000/

all disabled. Let’s see:

root@OdroidN2:~# cat uart1.dts
/dts-v1/;
/plugin/;
/ {
        compatible = "amlogic,g12b";
        fragment@0 {
                target-path = "/soc/bus@ff800000/serial@4000";
                __overlay__ {
                        status = "okay";
                };
        };
};
root@OdroidN2:~# dtc -I dts -O dtb -o /boot/overlay-user/uart1.dtbo uart1.dts
root@OdroidN2:~# G_CONFIG_INJECT 'user_overlays=' 'user_overlays=uart1' /boot/dietpiEnv.txt
root@OdroidN2:~# reboot
...
root@OdroidN2:~# l /dev/ttyAML6
crw-rw---- 1 root dialout 243, 6 Apr  3 23:57 /dev/ttyAML6

Uh, ttyAML6, I wanted ttyAML1 :smile:. Tested all others:

  • /proc/device-tree/soc/bus@ffd00000/serial@22000 => ttyAML6 as well :thinking:.
  • Tested the other two, and in all cases /dev/AML6 is present. I checked the device tree nodes and the one defined was set to “okay” as expected. Also when removing the overlay, /dev/ttyAML6 is gone.

Something is a little broken with this device tree. However, probably you can test the above first overlay with /dev/ttyAML6 and see whether this works on the pin you previously used:

apt install device-tree-compiler
mkdir -p /boot/overlay-user
cd /boot/overlay-user
cat << '_EOF_' > uart1.dts
/dts-v1/;
/plugin/;
/ {
	compatible = "amlogic,g12b";
	fragment@0 {
		target-path = "/soc/bus@ff800000/serial@4000";
		__overlay__ {
			status = "okay";
		};
	};
};
_EOF_
dtc -I dts -O dtb -o uart1.dtbo uart1.dts
G_CONFIG_INJECT 'user_overlays=' 'user_overlays=uart1' /boot/dietpiEnv.txt
reboot

ok, thank you. I will test and send you if it’s working with AML6

1 Like

so I used your guide.

but no AML6:

also don’t know why there is consoleargs in the dietpiEnv.txt

ok, I edited again dietpiEnv.txt because there was uartA and uartC in overlays
now I have a AML6:

but AML6 isn’t pin8 and pin10. Communicaton doesn’t work :

The procedure could be repeated with

/proc/device-tree/soc/bus@ffd00000/serial@22000
/proc/device-tree/soc/bus@ffd00000/serial@23000
/proc/device-tree/soc/bus@ffd00000/serial@24000

respectively. As mentioned above, they are all available via /dev/ttyAML6 for unknown reasons, but probably they still use different pins.

ok, means modify uart1.dts and do the rest ?
Strange that original path was
target-path = "/soc/bus@ff800000/serial@4000"
so now change step by step to

target-path = "/soc/bus@ffd00000/serial@22000"
target-path = "/soc/bus@ffd00000/serial@23000"
target-path = "/soc/bus@ffd00000/serial@24000"

Yes exactly. Let’s hope that, even when all of them enable /dev/ttyAML6, different GPIO pins are used.

One additional question. Where from we know this addresses ?

bus@ffd00000/serial@22000"

?

I tested all variants and not working

Okay, that is bad. Seems like the device tree is broken at a deeper level. Will take some time to have a closer look into upstream code and Armbian patches to see where it broke:

1 Like

thank you a lot for your efford

Out of curiosity, does this DTB work as desired? Don’t forget to disable all dynamically applied overlays
in your system if you replace your meson-g12b-odroid-n2-plus.dtb with the one provided, as it has already applied all the necessary overlays.

1 Like

??? Means download your file and place to the directory /boot/dtb-6.1.11-meson64/amlogic ?

Yep, I usually rename the original to meson-g12b-odroid-n2-plus-native.dtb, put additional DTBs with applied overlays alongside and add a symlink with the default name pointing to the default used one. In this way I can simply switch the used default and have all DTBs for an explicit selection available.