This is an old revision of the document!
Table of Contents
I2C
This page introduces how you can I2C interface using Expansion Board.
The Expansion Board have two I2C devices.
You can use the devices via H/W I2C(I2C-A) or S/W I2C(I2C-B : GPIO-I2C).
H/W I2C (I2C-A)
Kernel 3.10.y (node name) | Kernel 4.9.y (node name) | Pin Number (XU3/XU4 - CON10) | Net Name | Export Number | Description |
---|---|---|---|---|---|
/dev/i2c-4 | /dev/i2c-1 | 16 | GPB3[2](I2C_1.SDA) | 209 | SDA |
14 | GPB3[3](I2C_1.SCL) | 210 | SCL |
S/W I2C (I2C-B)
Kernel 3.10.y (node name) | Kernel 4.9.y (node name) | Pin Number (XU3/XU4-CON10) | Net Name | Export Number | Description |
---|---|---|---|---|---|
/dev/i2c-10 | 27 | GPX3[1](XEINT_25) | 33 | SDA | |
25 | GPX1[7](XEINT_15) | 23 | SCL |
How to check Expansion board with i2c-tools.
Install i2c-tools package.
odroid@odroid:~$ sudo apt-get install i2c-tools
I2C Device check command
- Usage : i2cdetect -y -r [i2c node name]
Using the HW I2C(I2C-A) with Expansion Board
I2C Device check
odroid@odroid:~$ sudo i2cdetect -y 4 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77 odroid@odroid:~$
- The 0x29 is BH1780 slave address.
- The 0x77 is BMP180 slave address.
Get BMP180 ID using i2cget.
odroid@odroid:~$ sudo i2cget 4 0x77 0xD0
H/W I2C Signals
Using the S/W I2C(I2C-B) with Expansion Board
Upload the module
GPIO-I2C driver probe [ i2c-gpio-custom driver option : id,sda,scl[,udelay,timeout,sda_open,scl_open,scl_outonly]
odroid@odroid:~$ sudo modprobe i2c-gpio-custom bus0=10,33,23,10,10
I2C Device check
odroid@odroid:~$ sudo i2cdetect -y -r 10 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77 odroid@odroid:~$
- The 0x29 is BH1780 slave address.
- The 0x77 is BMP180 slave address.
Get BMP180 ID using i2cget.
odroid@odroid:~$ sudo i2cget 10 0x77 0xD0
How to change the I2C clock speed
To change the I2C clock speed, you need to modify the DT(Device Tree) file.
Install required packages.
sudo apt-get install device-tree-compiler i2c-tools
Make a backup of DTB file.
cp /media/boot/meson64_odroidc2.dtb /media/boot/exynos5422-odroidxu3.dtb.org
Change the DTB file for i2c-1 (i2c channel #1) Find the i2c@12c70000 section in the dts file
fdtput -t i /media/boot/exynos5422-odroidxu3.dtb /i2c@12c70000 samsung,i2c-max-bus-freq "100000" sync reboot
If you want to go back to original 400Khz mode, change “10000” to “400000”.
Actual I2C clock speed (Measured with an oscilloscope)
In 400Khz mode : 370Khz
In 10Khz mode : 10Khz
Default I2C clock speed
XU4 : 400Khz mode