DTB Overlay not applying I2C clock-frequency change

I am trying to change the clock speed for i2c 0 and i2c 1. I made a new fragment for each in my dtb overlay file, changing the clock speeds to 1MHz. It does not seem to be applying after a reboot.

*** Please note that this reply is generated by LLM automatically ***

To change the clock speed for I2C 0 and I2C 1 on the Jetson Orin Nano, you have created a new fragment for each in your DTB overlay file and changed the clock speeds to 1MHz. However, after a reboot, the changes do not seem to be applying.

Firstly, let’s understand the context of the provided information. The original context is about changing the CAN clock rate, which is not directly related to your question about changing the I2C clock speed. However, we can still use the provided information as a reference to understand how to change clock rates in general.

To change the clock speed for I2C 0 and I2C 1, you need to update the clock rate in the device tree overlay file. The device tree overlay file is used to modify the device tree without recompiling the entire kernel.

Here are the steps to change the clock speed for I2C 0 and I2C 1:

  1. Create a new device tree overlay file (e.g., i2c_clock_overlay.dts) with the following content:
/dts-v1/;
/plugin/;

/ {
    compatible = "nvidia,jetson-orin-nano";

    fragment@0 {
        target = <&i2c0>;
        __overlay__ {
            clock-frequency = <1000000>; // 1MHz
        };
    };

    fragment@1 {
        target = <&i2c1>;
        __overlay__ {
            clock-frequency = <1000000>; // 1MHz
        };
    };
};

This overlay file sets the clock frequency of I2C 0 and I2C 1 to 1MHz.

  1. Compile the device tree overlay file using the dtc command:
dtc -I dts -O dtb -o i2c_clock_overlay.dtbo i2c_clock_overlay.dts

This will generate a i2c_clock_overlay.dtbo file.

  1. Copy the i2c_clock_overlay.dtbo file to the /boot directory:
sudo cp i2c_clock_overlay.dtbo /boot/
  1. Update the extlinux.conf file to include the new device tree overlay file:
sudo nano /boot/extlinux/extlinux.conf

Add the following line to the end of the file:

FDT /boot/i2c_clock_overlay.dtbo
  1. Reboot the system:
sudo reboot

After rebooting, the I2C clock speed should be changed to 1MHz.

To verify the changes, you can use the i2cdetect command:

sudo i2cdetect -y 0
sudo i2cdetect -y 1

This will show you the I2C devices connected to I2C 0 and I2C 1, and you can verify that the clock speed has been changed.

In comparison to the original context, changing the CAN clock rate involves updating the mttcan kernel driver, whereas changing the I2C clock speed involves updating the device tree overlay file. Both methods require a reboot to apply the changes.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

Adding FDT /boot/i2c_clock_overlay.dtbo made it no longer boot. Previously I was using OVERLAY_DTBO_FILE instead

hello jmarslan,

please note that, You can specify FDT alone. You can specify FDT + OVERLAYS. You cannot do only OVERLAYS though.
Overlays from Rootfs are processed only if DTB is coming from Rootfs. when FDT entry is not present in extlinux.conf UEFI DTB is used.

Okay, thank you. This helps for context. However, specifying FDT caused the machine to no longer boot. In the dtbo was:

/dts-v1/;
/plugin/;

/ {
    compatible = "nvidia,jetson";

    fragment@0 {
        target-path = "i2c@3160000";

        __overlay__ {
            clock-frequency = <1000000>;
        };
    };

    fragment@1 {
        target-path = "i2c@c240000";

    __overlay__ {
            clock-frequency = <1000000>;
        };
    };
};

hello jmarslan,

you should use the FDT to specify the device tree of your target,
for instance, this is device tree for Orin NX developer kit.
FDT /boot/dtb/kernel_tegra234-p3768-0000+p3767-0000-nv.dtb

Okay, thank you. I have edited extlinux.conf and my overlay file. It now boots and works as normal, however, the overlay/intended changes don’t seem to be getting applied.

extlinux.conf:

TIMEOUT 30
DEFAULT primary
 
MENU TITLE L4T boot options
 
LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      FDT /boot/dtb/kernel_tegra234-p3768-0000+p3767-0005-nv.dtb
      APPEND ${cbootargs} root=PARTUUID=f3980e0b-812d-4968-b3a0-5f5a19aac33c rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 nospectre_bhb video=efifb:off console=tty0 nv-auto-config OVERLAYS /boot/i2cClockOverlay.dtbo
      OVERLAY_DBT_FILE="i2cClockOverlay.dbto"

dbt overlay:

/dts-v1/;

/plugin/;
 
/ {

	overlay-name = "1MHz I2c Clock-Frequency";

	jetson-header-name = "Jetson 40pin Header";

	compatible = "nvidia,p3768-0000+p3767-0005", "nvidia,p3767-0005";

	fragment@0 {

		target-path = "/";

		__overlay__ {

			bus@0 {

				i2c@c250000 {

					status = "okay";

					clock-frequency = <1000000>;

					};

				};

		};

	};

	fragment@1 {

		target-path = "/";

		__overlay__ {

			bus@0 {

				i2c@c240000 {

					status = "okay";

					clock-frequency = <1000000>;

					};

				};

		};

	};

};

 

hello jmarslan,

that’s an incorrect property,
you should use OVERLAYS and assign the absolute path of your *.dtbo binary file.
FYI,
here’s an example for system loading IMX477 camera config,

TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
...

LABEL JetsonIO

        MENU LABEL Custom Header Config: <CSI Camera IMX477 Dual 4 lane>
...
        FDT /boot/dtb/kernel_tegra234-p3768-0000+p3767-0000-nv.dtb
        OVERLAYS /boot/tegra234-p3767-camera-p3768-imx477-dual-4lane.dtbo

Ah, thank you. Is creating a new LABEL necessary or is it okay to edit “primary“?

hello jmarslan,

typically, we’re having separate labels for the development process, it’s primary for default config, and others for loading customize settings.
you may switch back to default settings once there’s unexpected failure, such as kernel panic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.