VIM3: Change I2C Speed on Android

Hello,

I am using the most current Android firmware on a VIM3 Pro.
How can I change the I2C Clock Speed? What is the valid value range?

Thanks in advance.

Well by default I think it is 100 KHz,
you can check the A311D manual for the Highest supported clock ,
I have heard that I2C has a ceiling limit of 5 MHz but I am not sure if such amount is possible on this Chip please verify it

Here is a guide to the manuals


Hi, actually it is outputting with 100 kHz in Android.
I was looking to increase it to 400 kHz or maybe 1 MHz

1 Like

Ah yes, my apologies, I misread those zero’s, I believe you have to modify the file responsible for setting the Frequency itself, @Terry could you help here ?

@Terry: Could you please support me in this issue?

not tried it but expect you need to change the speed in the dts and rebuild it

i2c3 is on gpio pins 22 and 23 and has no I2C devices connected to it on the board. i2c4 has other devices linked to it on the board that you may stop working if you change that clock

3 Likes

@birty, mldevw was asking for Android firmware…

That is for android?

How do you update the changes ?

Need to built the DTS file into a dtb one then transfer the dtb one to the device - not sure where it goes on Android or how you have to pack the image - only really done pure Linux before

I think I have gained much experience of how to do that for Linux after that USB-OTG fiasco for trying to be able to SSH over USB :stuck_out_tongue_winking_eye:

What’s the system of your device? Ubuntu or Android? You can change the dts config on uboot environment variable with uboot command.

Hi,

thanks for the reply. I am using android. How exactly would I change this variable?

Thanks in advance.

You can modify the environment variable on uboot command mode.

# setenv port_mode_change "fdt addr ${dtb_mem_addr}; fdt set /cbus@ffd00000/i2c@1c000 clock-frequency <400000>; kbi portmode r;if test ${port_mode} = 0; then fdt set /usb3phy@ffe09080 portnum <1>;fdt set /pcieA@fc000000 status disable;else fdt set /usb3phy@ffe09080 portnum <0>;fdt set /pcieA@fc000000 status okay;fi;"
# saveenv
# reboot

cbus@ffd00000/i2c@1c000 is for i2c3 on gpio pins 22 and 23

3 Likes

Hello Terry,

thanks for your feedback.
I booted with serial console to uboot and entered what exactly you wrote (copy-paste).

Still I am seeing the same speed (100kHz) on I2C…
Is there something I have to change in the command line?

Thanks in advance!

how did you check the I2C speed?

With an oscilloscope.

1 Like

I will check it in this few days. :smiley:

1 Like

Sorry for that. You need to update the variable from cbus@ffd00000/i2c@1c000 to soc/cbus@ffd00000/i2c@1c000

# setenv port_mode_change "fdt addr ${dtb_mem_addr}; fdt set /soc/cbus@ffd00000/i2c@1c000 clock-frequency <400000>; kbi portmode r;if test ${port_mode} = 0; then fdt set /usb3phy@ffe09080 portnum <1>;fdt set /pcieA@fc000000 status disable;else fdt set /usb3phy@ffe09080 portnum <0>;fdt set /pcieA@fc000000 status okay;fi;"
# saveenv
# reboot
3 Likes