====== I2C ======
This page introduces how you can interface your I2C devices to **ODROID-C** series.
===== H/W connection =====
**I2CA (/dev/i2c-1)**
^Pin Number^Net Name^Export Number^^
^:::^:::^C0/C1/C1+^C2^
|3|I2CA.SDA|74|205|
|5|I2CA.SCL|75|206|
**I2CB (/dev/i2c-2)**
^Pin Number^Net Name^Export Number^^
^:::^:::^C0/C1/C1+^C2^
|27|I2CB.SDA|76|207|
|28|I2CB.SCL|77|208|
===== Loading I2C driver =====
Dedicated pins for I2C are configured for GPIO, these pins can be configured as I2C bus while change the pin configuration. In order to change the configuration, you must load the driver.
$ modprobe aml_i2c
If you have to load the driver every time whenever your **ODROID-C** starts, simply you can register the driver into **/etc/modules**.
$ echo "aml_i2c" | sudo tee /etc/modules
This adds one line at end of the file, /etc/modules, and load the driver on boot automatically.
===== 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/meson64_odroidc2.dtb.org
Change the DTB file for i2c-1 (i2c channel #1)
fdtput -t i /media/boot/meson64_odroidc2.dtb /i2c@c1108500 master_i2c_speed "100000"
sync
reboot
Change the DTB file for i2c-2 (i2c channel #2)
fdtput -t i /media/boot/meson64_odroidc2.dtb /i2c@c11087c0 master_i2c_speed "100000"
sync
reboot
If you want to go back to original 300Khz mode, change "100000" to "300000".\\
**Actual I2C clock speed** (Measured with an oscilloscope)\\
In 300Khz mode : 270Khz \\
In 100Khz mode : 80Khz \\
**Default I2C clock speed** \\
C1/C1+/C0 : 100Khz mode \\
C2 : 400Khz mode \\
===== Tutorials =====
[[wb_c_16x2lcd|{{:en:weather_board:weatherboard16x2.jpg?150|}}]] [[wb_c|{{:en:weather_board:wb_odroidc5.png?135|}}]]
* [[ wb_c_16x2lcd | WEATHER-BOARD with 16x2 LCD on ODROID-C ]]
* [[ wb_c | WEATHER-BOARD on ODROID-C ]]