GPIO I2C speed (SCK)

I’m using VIM1_Ubuntu-xfce-bionic_Linux-4.9_arm64_SD-USB_V20191231 ROM. Is there is a way to change default i2c frequency? I’m running i2cdetect utility and as I can see it is around 400kHz (390) by default. How can I configure it to 100kHz ?

just change dtb file

cd /boot
cp dtb.img dtb.img.bak
dtc dtb.img > dtb.img.dts
nano dtb.img.dts

find i2c node and change freq from

clock-frequency = <0x61a80>;

to

clock-frequency = <0x186a0>;

rebuid dtb file

dtc dtb.img.dts > dtb.img

reboot

PS: 0x61a80 == 400000 and 0x186a0 == 100000

3 Likes

Thanks a lot! Will it affect both I2CA (pins 22,23) and I2CB (pins 25,26) ?

In my case Nodes are:

i2c@8500 - /dev/i2c-0 - i2cA
i2c@87c0 - /dev/i2c-1 - i2cB

Just trying to get my i2c devices to show up, my logic analyser is showing the i2c clock to be 400khz on a vim1, i need to slow that down for a variety of reasons but mainly due to bus length.

read the posts above but my /boot does not have the same files mentioned,

I have decompiled kvim_linux.dtb with dtc, is this the correct file?

Can you show ls -l your /boot ?

It may be inside the /boot/dtb/kvim_linux.dtb for vim1 respectively.

It was, sorted it now

FENIX images with vendor kernel already use 100Khz by default
NOTE: mainline kernel always use 100Khz