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:c_hardware_i2c [2016/12/01 14:05] odroid [Loading I2C driver] |
en:c_hardware_i2c [2017/01/19 13:21] charles.park [How to change the I2C clock speed] |
||
---|---|---|---|
Line 24: | Line 24: | ||
</code> | </code> | ||
This adds one line at end of the file, /etc/modules, and load the driver on boot automatically. | 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. | ||
+ | <code> | ||
+ | sudo apt-get install device-tree-compiler i2c-tools | ||
+ | </code> | ||
+ | |||
+ | Make a backup of DTB file. | ||
+ | <code> | ||
+ | cp /media/boot/meson64_odroidc2.dtb /media/boot/meson64_odroidc2.dtb.org | ||
+ | </code> | ||
+ | |||
+ | Change the DTB file for i2c-1 (i2c channel #1) | ||
+ | <code> | ||
+ | fdtput -t i /media/boot/meson64_odroidc2.dtb /i2c@c1108500 master_i2c_speed "100000" | ||
+ | sync | ||
+ | reboot | ||
+ | </code> | ||
+ | |||
+ | Change the DTB file for i2c-2 (i2c channel #2) | ||
+ | <code> | ||
+ | dtput -t i /media/boot/meson64_odroidc2.dtb /i2c@c11087c0 master_i2c_speed "100000" | ||
+ | sync | ||
+ | reboot | ||
+ | </code> | ||
+ | |||
+ | If you want to go back to original 300Khz mode, change "100000" to "300000".\\ | ||
+ | |||
+ | **Actual I2C clock speed.** Measured with oscilloscope\\ | ||
+ | In 300Khz mode : 270Khz \\ | ||
+ | In 100Khz mode : 80Khz \\ | ||
+ | |||
===== Tutorials ===== | ===== Tutorials ===== | ||
[[wb_c_16x2lcd|{{:en:weather_board:weatherboard16x2.jpg?150|}}]] [[wb_c|{{:en:weather_board:wb_odroidc5.png?135|}}]] | [[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_16x2lcd | WEATHER-BOARD with 16x2 LCD on ODROID-C ]] | ||
* [[ wb_c | WEATHER-BOARD on ODROID-C ]] | * [[ wb_c | WEATHER-BOARD on ODROID-C ]] |