We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:xu3_hardware_i2c [2017/04/26 14:02]
charles.park [How to check Expansion board with i2c-tools.]
en:xu3_hardware_i2c [2017/07/07 11:29] (current)
john1117 [How to change the I2C clock speed]
Line 6: Line 6:
 {{:​en:​xu3:​xu3_i2c_with_expansion.png?​700|}} {{:​en:​xu3:​xu3_i2c_with_expansion.png?​700|}}
  
-You can use the devices via I2C-A(H/W I2C) or I2C-B(GPIO-I2C).+You can use the devices via H/W I2C(I2C-A) or S/W I2C(I2C-B GPIO-I2C).
  
 **H/W I2C (I2C-A)** **H/W I2C (I2C-A)**
Line 26: Line 26:
 **I2C Device check command** **I2C Device check command**
    * Usage : i2cdetect -y -r [i2c node name]    * Usage : i2cdetect -y -r [i2c node name]
 +===== Using the HW I2C(I2C-A) with Expansion Board =====
 +
 +**I2C Device check**
 +<​code>​
 +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:​~$ ​
 +</​code>​
 +
 +   * The 0x29 is BH1780 slave address.\\
 +   * The 0x77 is BMP180 slave address.
 +
 +**Get BMP180 ID using i2cget.**
 +
 +<​code>​
 +odroid@odroid:​~$ sudo i2cget 4 0x77 0xD0
 +</​code>​
 +
 +==== H/W I2C Signals ====
 +{{:​en:​weather_board:​hwi2c.png?​500|}}
 +
 ===== Using the S/W I2C(I2C-B) with Expansion Board ===== ===== Using the S/W I2C(I2C-B) with Expansion Board =====
  
Line 35: Line 66:
 </​code>​ </​code>​
  
-**Expansion boarrd ​check command** +**I2C Device ​check**
-  * Usage : i2cdetect -r -y [i2c-dev node number] +
 <​code>​ <​code>​
 odroid@odroid:​~$ sudo i2cdetect -y -r 10 odroid@odroid:​~$ sudo i2cdetect -y -r 10
Line 62: Line 91:
 </​code>​ </​code>​
   ​   ​
-===== Using the HW I2C(I2C-A) with Expansion Board ===== 
  
 +===== 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.
 <​code>​ <​code>​
-odroid@odroid:​~$ ​sudo i2cdetect ​-y 4+sudo apt-get install device-tree-compiler i2c-tools 
 +</​code>​
  
-    0  1  2  3  ​4 ​ ​5 ​ 6  7  8  ​ ​a ​ b  c  d  e  f                              +Make a backup of DTB file. 
-00:          -- -- -- -- -- -- -- -- -- -- -- -- --                              +  * kernel ​4.9.y 
-10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                              +<​code>​ 
-20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- --                              +cp /​media/​boot/​exynos5422-odroidxu4.dtb /​media/​boot/​exynos5422-odroidxu4.dtb.org 
-30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                              +</​code>​ 
-40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                              +  * kernel 3.10.y 
-50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                              +<​code>​ 
-60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                              +cp /​media/​boot/​exynos5422-odroidxu3.dtb /​media/​boot/​exynos5422-odroidxu3.dtb.org 
-70: -- -- -- -- -- -- -- 77+</​code>​
  
-odroid@odroid:​~$ ​+Using dtc command, you can make "​dts"​ type of device tree from "​dtb"​ type. 
 +  * kernel 4.9.y 
 +<​code>​ 
 +dtc -I dtb -O dts -o exynos5422-odroidxu4.dts exynos5422-odroidxu4.dtb 
 +</​code>​ 
 +  * kernel 3.10.y 
 +<​code>​ 
 +dtc -I dtb -O dts -o exynos5422-odroidxu3.dts exynos5422-odroidxu3.dtb
 </​code>​ </​code>​
  
-   * The 0x29 is BH1780 slave address.\\ +And, open by an editor you like it and check the i2c path
-   * The 0x77 is BMP180 slave address.+<​code>​ 
 +vi exynos5422-odroidxu4.dts
  
-**Get BMP180 ID using i2cget.**+-------------------------------------- 
 +.
 +/ { 
 +.. 
 +    soc { 
 +.. 
 +    i2c@12C70000 { 
 +.. 
 +-------------------------------------- 
 +</​code>​
  
 +Check current maximum bus frequency of i2c@12C70000
 +  * kernel 4.9.y
 <​code>​ <​code>​
-odroid@odroid:~$ sudo i2cget ​10 0x77 0xD0+fdtget /​media/​boot/​exynos5422-odroidxu4.dtb /soc/i2c@12C70000 samsung,​i2c-max-bus-freq 
 +</​code>​ 
 +  * kernel 3.10.y 
 +<​code>​ 
 +fdtget /​media/​boot/​exynos5422-odroidxu3.dtb /​i2c@12C70000 samsung,​i2c-max-bus-freq
 </​code>​ </​code>​
  
-===== H/W I2C Signals ===== +Change the DTB file for i2c-1 (i2c channel #1) 
-{{:​en:​weather_board:​hwi2c.png?500|}} +  * kernel 4.9.y 
-===== S/I2C Signals ===== +<​code>​ 
-{{:en:weather_board:swi2c.png?500|}}+fdtput -t i /media/​boot/​exynos5422-odroidxu4.dtb /​soc/​i2c@12C70000 samsung,​i2c-max-bus-freq "​10000"​ 
 +sync 
 +reboot 
 +</​code>​ 
 +  * kernel 3.10.y 
 +<​code>​ 
 +fdtput -t i /media/​boot/​exynos5422-odroidxu3.dtb /​i2c@12C70000 samsung,​i2c-max-bus-freq "​10000"​ 
 +sync 
 +reboot 
 +</​code>​ 
 + 
 +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 344.8khz \\ 
 +In 100Khz mode 63.7khz \\ 
 +In 10Khz mode 9.3Khz \\ 
 + 
 +**Default I2C clock speed** \\ 
 + 
 +XU4 : 400Khz mode \\ 
en/xu3_hardware_i2c.1493184775.txt.gz · Last modified: 2017/04/26 14:02 by charles.park
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0