Device Tree Overlay (Odroid C4) inactive?

Sorry to bump an old thread.

I’m just wondering if there is something I need to do in order to enable either of the i2c ports on an Odroid C4.

I can find lots of references to i2c within the file system, other than in

/dev/

where I would expect to see something like

/dev/i2c-x

(I’m trying to get Node-Red to read a simple voltage value from an i2c voltage meter, as a way to create a very basic UPS with auto shutdown.
As in, voltage <10 = fire out a few commands then shutdown)

With our current image, add “i2cA” and/or “i2cB” to the “overlays=” line in /boot/dietpiEnv.txt to enable I2C devices. For more info about available overlays, see /boot/dtb/amlogic/overlay/README.meson-overlays … although, not this content doesn’t match to what the dtb package ships… /boot/dtb/amlogic/overlay/ contains the available overlays with *.dtbo file extension. Those can be added to dietpiEnv.txt, omitting the “meson-” prefix and the file extension.

Hello,
I have downloaded the latest image for Odroid c4 and I still have all the problems that the previous posters mentioned, i.e. absence of DTB overlays which are needed for HDMI sound, for all UARTS, not just 2 UARTS, and for the PCF8563 RTC clock. Furthermore on a Waveshare 7" display the first 20 rasterlines are ALWAYS hanging down and are missing at the bottom. This is true even for text mode and also for the 1024x600 graphics mode.
There are more UARTS and more I2C’s and the real time clock too.
The whole distro was updated with the dietpi-config menus and options, to no avail.

Linux DietPi 5.10.147-meson64 #22.08.4 SMP PREEMPT Fri Oct 7 16:37:19 UTC 2022 aarch64 GNU/Linux

Otherwise this distro is quite performant so any help is greatly appreciated.

Did you had a look into this?

Yes I looked at that directory.
I miss uart0 uart1 uart2 uart3 pcf8563
Other distros have them, most notably due to a user called “tobetter”, who modded something, but not for DietPi.

Hello!
I tried the latest “bookworm” DietPI release for Odroid C4.
My /boot/dietpiEnv.txt looks like this :

[main]
rootdev=UUID=6c6e9160-adf2-44d0-80df-07201edf6a9f
rootfstype=ext4
# The init system logs to the console defined last.
consoleargs=console=ttyAML0,115200 console=tty1
usbstoragequirks=
extraargs=net.ifnames=0
docker_optimizations=off
overlay_path=amlogic
overlay_prefix=meson
overlays=uartA,uartC
user_overlays=

Still, I do not have the overlays, not even these two uart’s. What am I doing wrong?

Hello, still trying to get to the bottom of what is happening with i2c on the Odroid C4.

I haven’t found any solutions to i2c yet by looking through the forum. I’m just trying to get an INA3221 and a few other devices working as apart of a robotics project.

I’m currently on DietPi 9.6.1

I have looked into the /boot/dietpiEnv.txt to change the overlays. The /boot/dtb/amlogic/overlay readme file said that I could add i2c8, however this didn’t work. I have tried every configuration of i2cA, B, 1, 2, 3. Nothing has worked so far.

Next I turned to the official Odroid Wiki since I thought I was doing something wrong.
On this webpage: OdroidWiki
I found some useful tips about using device-tree-compiler and fdtget to get the status of the I2C bus devices. This didn’t work with the device trees in /boot/dtb-6.6.37-current-meson64 (Honestly I thought it was worth a try, but the kernel versions are quite different.)

I also looked to see if there were any kernel modules loaded in relation to i2c. I didn’t find any. I did find the video modules though, which probably is why the HDMI is showing up on I2C, but nothing else.

Finally, I checked Armbian’s guidance for overlays here: Armbian (Allwinner)
I did notice that they specify this:

Notes regarding SPI and I2S overlays

Activating a device on SPI or I2S bus may require more than one overlay. In case a bus overlay like spi0 or i2s0 exist for the target SoC they need to be activated in addition to a slave device overlay (provided or custom/user-made).

With their example overlays Env.txt looking like this:

overlays=w1-gpio uart1 i2c0 spi-spidev

So logically I found two modules that looked like they might need to be activated in accordance with this guidance. That was both w1-gpio and w1AB-gpio. I added those to my overlays and rebooted. Still nothing.

Armbian’s final guidance is this:

Debugging

As overlays and overlay parameters are applied by the u-boot, it is impossible to get any debugging information (such as error messages) from the OS. Serial console on UART 0 is required to debug DT overlay related problems.

Before I go further, I think I’m in over my head here and I need some help to solve this one.
For now in the project I can probably use a separate microcontroller as a crutch with serial, but the best solution would be to use one of the two busses that are already on the board. I would seriously appreciate any guidance anyone can give, as I’m trying to get at least one of my projects close to some kind of completion lol.

Thanks for your time,
– James

I’ve got uartA working on Odroid C4 with DietPi v9.15.2 by using a custom overlay.

Create meson-uartA.dts file:

/dts-v1/;
/plugin/;

/ {
    compatible = "amlogic,meson-gxbb";

    fragment@0 {
        target-path = "/soc/bus@ff600000/bus@34400/pinctrl@40";

        __overlay__ {
            uart_a_tx_pin: uart-a-tx {
                mux {
                    groups = "uart_a_tx";
                    function = "uart_a";
                    input-disable;
                    output-enable;
                    drive-strength-microamp = <4000>;
                };
            };
        };
    };

    fragment@1 {
        target-path = "/soc/bus@ffd00000/serial@24000";

        __overlay__ {
            status = "okay";
            pinctrl-0 = <&uart_a_pins &uart_a_tx_pin>;
            pinctrl-names = "default";
        };
    };
};

Compile it:

dtc -I dts -O dtb -o meson-uartA.dtbo -b 0 -@ meson-uartA.dts

Replace /boot/dtb/amlogic/overlay/meson-uartA.dtbo with a newly compiled one.

In /boot/dietpiEnv.txt set overlays=uartA

Reboot the system.

The serial port will show as /dev/ttyAML6 for some reason, but it’s functional.

I found the solution here: Как запустить UART на Banana Pi BPI-M5
It was originally made for Banana Pi BPI-M5, but fortunately works with Odroid C4.

Hi

I too am looking for the “approved” DietPi method of enabling an I2C bus on the Odroid C4.

The C2 I have, has the I2C menu option, but none the C4 units I have do .

If I install I2C-tools and run i2cdetect -l it shows the HDMI I2C bus, but nothing else.

xxxx@Velbus-Blinds:~# i2cdetect -l
i2c-0   i2c             DesignWare HDMI                         I2C adapter```

Is your preferred method still to add these two lines?

This is part of the content of my dietpiEnv.txt now

extraargs=net.ifnames=0

docker_optimizations=off

overlay_path=amlogic

overlay_prefix=meson

overlays=i2c i2cA i2cB

user_overlays=

Cheers,

Stuart

@MichaIng

Adding this to the dietpiEnv.txt file gets a result

overlays=i2c sm1-odroid-c4-i2c0 sm1-odroid-c4-i2c1 sm1-odroid-c4-i2c2

Which I derived from reading this document you referred to

cat /boot/dtb/amlogic/overlay/README.meson-overlays

Dropping meson- from the start of the lines

I’m not sure where i2c8 fits into this, but I feel like I’ve moved forward :face_with_peeking_eye:

i2cdetect -l

xxxx@Velbus-Blinds:~# i2cdetect -l
i2c-0 i2c Meson I2C adapter I2C adapter
i2c-1 i2c Meson I2C adapter I2C adapter
i2c-2 i2c DesignWare HDMI I2C adapter

Next step is seeing what happens in NodeRed and the i2c pallette…

Did you get yours working?

Does this help? ^^^^^^^^

Nice, the dts files can also be reviewed here, which gives some more insights about which device tree nodes are enabled or configured exactly: build/patch/kernel/archive/meson64-6.18/overlay at main · armbian/build · GitHub

i2c and sm1-odroid-c4-i2c2 do not exist.

Hi

I’m happy to test anything

Or give you access to a machine (or two :laughing:)

I’m happy to report that there’s zero change if I remove

i2c and sm1-odroid-c4-i2c2

Still seeing the three I2C busses

Thanks a million