Manipulate I2C bus speed

Moderators: mdrjr, odroid

Manipulate I2C bus speed

Unread postby ttsolov » Wed Jul 11, 2018 4:04 am

Hi,
is it possible to set different I2C bus speed under Android?

Thanks in advance.
ttsolov
 
Posts: 1
Joined: Wed Jul 11, 2018 4:00 am
languages_spoken: english

Re: Manipulate I2C bus speed

Unread postby odroid » Wed Jul 11, 2018 9:46 am

You need to modify the DeviceTree file in the Kernel source to adjust the I2C clock speed.
User avatar
odroid
Site Admin
 
Posts: 28233
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Manipulate I2C bus speed

Unread postby snorky35 » Fri Jul 13, 2018 6:01 pm

Hi guys,

I'm also in the same case : i would like to modify I2C speed from 400kHz (measured) to 100kHz as my PN512 is not detected using :
Code: Select all
i2cdetect -y 5
in adb shell.
I changed in "kernel/hardkernel/odroidxu3/arch/arm/boot/dts/exynos5422-odroidxu3.dts" the frequency with :
Code: Select all
i2c_1: i2c@12C70000 {
    samsung,i2c-max-bus-freq = <100000>;
    status = "okay";
};


But when i build (from scratch, clean build) and deploy, using an oscilloscope, i still have 400kHz (approx. 363kHz measured).
Is there something i'm doing wrong ?

(Moreover, i was not able to find where i2c_1 is mapped to /dev/i2c-5)
snorky35
 
Posts: 25
Joined: Thu Nov 26, 2015 5:32 am
languages_spoken: english
ODROIDs: C1+ C2 XU4

Re: Manipulate I2C bus speed

Unread postby odroid » Fri Jul 13, 2018 6:07 pm

Do you use Pin16/14 on 30pin header?
The device node number is different in Android Kernel 3.0 from generic Ubuntu Kernel 4.x.
Please look into this wiki page carefully.
https://wiki.odroid.com/old_product/acc ... nboard/i2c
User avatar
odroid
Site Admin
 
Posts: 28233
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Manipulate I2C bus speed

Unread postby snorky35 » Fri Jul 13, 2018 9:25 pm

Yes, i'm using pins 16 & 14 for respectively SDA and SCL, and i'm using Lineage OS 14.1 from voodik

Code: Select all
odroidxu3:/ # ll /sys/class/i2c-dev/                                                                                                                                                                         
total 0
drwxr-xr-x  2 root root 0 2018-07-13 12:19 .
drwxr-xr-x 50 root root 0 2018-07-13 12:19 ..
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-0 -> ../../devices/12ca0000.hsi2c/i2c-0/i2c-dev/i2c-0
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-1 -> ../../devices/12cb0000.hsi2c/i2c-1/i2c-dev/i2c-1
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-2 -> ../../devices/12e00000.hsi2c/i2c-2/i2c-dev/i2c-2
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-3 -> ../../devices/i2c_gpio.8/i2c-3/i2c-dev/i2c-3
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-4 -> ../../devices/12c60000.i2c/i2c-4/i2c-dev/i2c-4
lrwxrwxrwx  1 root root 0 2018-07-13 12:23 i2c-5 -> ../../devices/12c70000.i2c/i2c-5/i2c-dev/i2c-5


From what i can see, the section that i did modify (i2c_1 : I2C@12c70000) is mapped to /dev /i2c-5, so i don't understand why the SCL clock speed is still about 400kHz as you can see on the picture below

20180713_154908.jpg
20180713_154908.jpg (141.45 KiB) Viewed 37 times
snorky35
 
Posts: 25
Joined: Thu Nov 26, 2015 5:32 am
languages_spoken: english
ODROIDs: C1+ C2 XU4

Re: Manipulate I2C bus speed

Unread postby odroid » Sat Jul 14, 2018 10:24 am

I think you should modify i2c-4 entry instead of i2c-5. lrwxrwxrwx 1 root root 0 2018-07-13 12:23 i2c-4 -> ../../devices/12c60000.i2c/i2c-4/i2c-dev/i2c-4
User avatar
odroid
Site Admin
 
Posts: 28233
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Android

Who is online

Users browsing this forum: No registered users and 2 guests

cron