Instructions for changing I2C bus frequency

Instructions for changing the clock frequency of the I2C bus as I did not find it else where when figuring out how to do it.

The default clock frequency of I2C is 100kHz, to change to another frequency (400kHz, 1MHz etc) you need to create an overlay for the I2C bus you want modified.

In my configuration I use rsetup to enable I2C0-M1 on GPIO pins 28 (SCL) and 27 (SDA).

To change the clock frequency to 400kHz create a file name i2c0-400khz.dts with contents;

/dts-v1/;
/plugin/;

/ {
    metadata {
        title = "Set I2C0-M1 to 400khz";
        category = "misc";
        compatible = "radxa,rock-5b", "rockchip,rk3588";
        description = "Set I2C0-M1 to 400khz";
    };
  
    fragment@0 {
        target = <&i2c0>;
        __overlay__ {
            clock-frequency = <400000>; // Set to 400 kHz
        };
    };    
};

Then load rsetup and select menu option Overlay->Install 3rd party overlay and select the file we created. This will then install our overlay.

Exit rsetup and reboot for the change to take effect.

If your running I2C on a different GPIO configuration, then modify the target = <&i2c0>; parameter in the above overlay file and set it appropriately to the bus you want changed.

1 Like

thanks, I assume that You need to increase it for some LCD panels?
Have You checked how power consumption increased?

I have not checked power consumption, however a paper calculation would give 0.1089 mW (100kHz) vs 0.4356 mW (400kHz).

1 Like

I don’t expect anything high for just one thing, but always worth to check :slight_smile: