Tinker Board Forum

Full Version: How to change I2C speed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Would you please teach me how to change I2C speed?
Thanks
Hi chobio

i don't have scope to measure clock rate, but you still can give it a try. Tongue
---------------------------------------------------------------------------------------------------
please follow up https://tinkerboarding.co.uk/wiki/index....are#Kernel to download kernel of Tinkerboard.
and push my attachment(you can modify frequency as you want) to kernel/arch/arm/boot/dts/overlays/

then, you can start to build kernel. after building, copy kernel/arch/arm/boot/dts/overlays/i2c-clock-freq.dtbo to /boot/overlays/ of tinkerboard.
and modify /boot/hw_intf.conf as below

intf:i2c1=on
intf:i2c4=on
intf:dtoverlay=i2c-clock-freq

after rebooting, check with "xxd /proc/device-tree/i2c@ff650000/clock-frequency"  

P.S. mapping table as below:
i2c@ff650000 ->I2C0
i2c@ff140000 ->I2C1
i2c@ff660000 ->I2C2
i2c@ff150000 ->I2C3
i2c@ff160000 ->I2C4
i2c@ff170000 ->I2C5
Hi scorpiochang

Thank you for your advice.
Unfortunately, i have not success....

xxd /proc/device-tree/i2c@ff650000/clock-frequency
not changed value...
Hi Chobio

Can you brief what steps you did,...

And
1. Please share hw_inrt.conf, i2c-clock-freq-overlay.dts and i2c-clock-freq.dtbo?
2. Please make sure i2c-clock-freq.drbo exist in /boot/overlays/ of tinkerboard.

P.S. How to build *.dtbo, refer to https://tinkerboarding.co.uk/forum/thread-998.html
hello scopiochang  chobio,

I try to i2c speed up too.

> scopipchang
thank you for your dts file and infomation about how to import.

so, I will send my hw_intf.conf, dts and dtbo.
could you check it ?

and I found the file "clock-frequency" here in tinkerboad. 
> ls /sys/firmware/devicetree/base/i2c*

i2c@ff140000:
#address-cells  clock-frequency  clocks      interrupts  phandle    pinctrl-names  status
#size-cells     clock-names      compatible  name        pinctrl-0  reg


Does i2C1 become 400000bps ??

thanks
Hi u26

cat you help to try xxd clock-frequency!

linaro@tinkerboard:/proc/device-tree/i2c@ff140000$ xxd clock-frequency
00000000: 0006 1a80
Hi scopiochang,

I could check the frequency.
so I will try on real decive.

thanks.

u26
Hi chobio and u26

forget to notice you, sholue add "i2c-clock-freq.dtbo" at Makefile as below:

kernel/arch/arm/boot/dts/overlays/Makefile

ds1307.dtbo \
lirc-rpi.dtbo \
lirc-toshiba.dtbo \
i2c-clock-freq.dtbo \
Hi scorpiochang,

Thank you for your support.
I using TinkerOS ver.1.8 ,so this is problem for not working ovrerlays.
when using Ver.2.04, it works.
Thank you.

by the way, I looking for the way how to OS upgrade from ver.1.8 to 2.04 without sd image rewrite. (like raspberry pi rpi-update)
if you know the way, i am very happy...
Hi chobio

You need to build uboot by self.
https://github.com/TinkerBoard/debian_u-boot?files=1

[Linux]
Building image:
$ cd debian_u-boot
$ make CROSS_COMPILE=arm-linux-gnueabihf- O=miniarm-rk3288 tinker-rk3288_defconfig all -j4
$ ./miniarm-rk3288/tools/mkimage -n rk3288 -T rksd -d miniarm-rk3288/spl/u-boot-spl-dtb.bin u-boot.img
$ cat miniarm-rk3288/u-boot.bin >> u-boot.img

Flash uboot image:
Prepare one sdcard which has the full Debian image inside.
then insert the sdcard into a linux based OS, and suppose the block device of the sdcard is /dev/sdx
$ sudo dd if=[path]/u-boot.img of=/dev/sdx seek=64

Please backup flash firstly, and be careful with dd operation.
How to backup sdcard: 
https://tinkerboarding.co.uk/forum/thread-900.html
Pages: 1 2