Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:xu3_hardware_i2c [2017/04/26 14:07] charles.park |
en:xu3_hardware_i2c [2017/06/19 17:31] neal [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 92: | Line 92: | ||
| | ||
- | ==== S/W I2C Signals ==== | + | ===== How to change the I2C clock speed ===== |
- | {{:en:weather_board:swi2c.png?500|}} | + | To change the I2C clock speed, you need to modify the DT(Device Tree) file.\\ |
+ | |||
+ | Install required packages. | ||
+ | <code> | ||
+ | sudo apt-get install device-tree-compiler i2c-tools | ||
+ | </code> | ||
+ | |||
+ | Make a backup of DTB file. | ||
+ | <code> | ||
+ | cp /media/boot/exynos5422-odroidxu4.dtb /media/boot/exynos5422-odroidxu4.dtb.org | ||
+ | </code> | ||
+ | |||
+ | Using dtc command, you can make "dts" type of device tree from "dtb" type. | ||
+ | <code> | ||
+ | dtc -I dtb -O dts -o exynos5422-odroidxu4.dts exynos5422-odroidxu4.dtb | ||
+ | </code> | ||
+ | |||
+ | And, open by an editor you like it and check the i2c path. | ||
+ | <code> | ||
+ | vi exynos5422-odroidxu4.dts | ||
+ | |||
+ | -------------------------------------- | ||
+ | .. | ||
+ | / { | ||
+ | .. | ||
+ | soc { | ||
+ | .. | ||
+ | i2c@12C70000 { | ||
+ | .. | ||
+ | -------------------------------------- | ||
+ | </code> | ||
+ | |||
+ | Check current maximum bus frequency of i2c@12C70000 | ||
+ | |||
+ | <code> | ||
+ | fdtget /media/boot/exynos5422-odroidxu4.dtb /soc/i2c@12C70000 samsung,i2c-max-bus-freq | ||
+ | </code> | ||
+ | |||
+ | Change the DTB file for i2c-1 (i2c channel #1) | ||
+ | |||
+ | <code> | ||
+ | fdtput -t i /media/boot/exynos5422-odroidxu4.dtb /soc/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 \\ |