This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:common:applications:gpio:i2c [2022/07/12 04:54] nick |
products:sbc:common:applications:gpio:i2c [2023/11/07 04:51] (current) nick [Enable I2C] |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | This document mainly | + | This page introduces the usage of I2C bus on [[products: |
| ===== I2C Information ===== | ===== I2C Information ===== | ||
| - | < | + | | |
| + | ^ | ||
| + | | ::: | ::: | 23(SDA) | ||
| + | | ::: | ||
| + | | ::: | ::: | 26(SDA) | ||
| + | ^ VIM3/ | ||
| + | | ::: | ::: | 23(SDA) | ||
| + | | ::: | ||
| + | | ::: | ::: | 26(SDA) | ||
| + | ^ VIM4 | ||
| + | | ::: | ::: | 23(SDA) | ||
| + | | ::: | ||
| + | | ::: | ::: | 26(SDA) | ||
| + | ^ VIM1S | I2CM B | 22(SCL) | ||
| + | | ::: | ::: | 23(SDA) | ||
| + | | ::: | ||
| + | | ::: | ::: | 26(SDA) | ||
| - | ^ | + | ===== Enable |
| - | | I2C A | SCL(22) - GPIODV_25 (#474)\\ SDA (23) - GPIODV_24 (# | + | |
| - | | I2C B | SCL(25) - GPIODV_27 (#476)\\ SDA(26) - GPIODV_26 (# | + | |
| + | In order to use the I2C, you need to enable the I2C function via [[products: | ||
| - | < | + | < |
| - | ^ I2C ^ PIN & GPIO Number | + | Edit '' |
| - | | I2CM 3 | SCL(22) - GPIOA_15 (#475)\\ SDA(23) - GPIOA_14 (# | + | |
| - | | I2C AO | SCL(25) - GPIOAO_2 (#498)\\ SDA(26) - GPIOAO_3 (# | + | |
| - | <tabbox VIM4> | + | Take VIM3 as an example to enable '' |
| - | ^ I2C ^ PIN & GPIO Number | + | ```shell |
| - | | I2CM F | SCL(22) - GPIOY_17 (#501)\\ SDA (23) - GPIOY_18 (# | + | overlays=uart4 pwm_ao_a pwm_f i2c3 |
| - | | I2CM A | SCL(25) - GPIOT_20 (#466)\\ SDA(26) - GPIOT_21 (# | + | ``` |
| + | After reboot, you will see the I2C device node. | ||
| - | </tabbox> | + | ```shell |
| + | $ ls /dev/i2c-3 | ||
| + | / | ||
| + | ``` | ||
| - | ===== Enabel I2C ===== | + | <tabbox VIM3 with 5.15 kernel> |
| - | In order to use the I2C, you need to enable the I2C function via [[products: | + | Edit ''/ |
| - | <tabbox VIM1/ | ||
| - | |||
| - | Edit ''/ | ||
| - | Take VIM3 as an example to enable '' | + | e.g. To enable '' |
| ```shell | ```shell | ||
| - | overlays=uart4 pwm_ao_a pwm_f i2c3 | + | fdt_overlays=i2c3 |
| ``` | ``` | ||
| After reboot, you will see the I2C device node. | After reboot, you will see the I2C device node. | ||
| + | |||
| + | <tabbox VIM3L with 5.15 kernel> | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | |||
| + | e.g. To enable '' | ||
| ```shell | ```shell | ||
| - | $ ls /dev/i2c-3 | + | fdt_overlays=i2c3 |
| - | /dev/i2c-3 | + | |
| ``` | ``` | ||
| + | |||
| + | After reboot, you will see the I2C device node. | ||
| <tabbox VIM4> | <tabbox VIM4> | ||
| - | Edit ''/ | + | Edit ''/ |
| - | e.g. Enable | + | e.g. To enable |
| ```shell | ```shell | ||
| Line 67: | Line 91: | ||
| $ ls /dev/i2c-0 | $ ls /dev/i2c-0 | ||
| /dev/i2c-0 | /dev/i2c-0 | ||
| + | ``` | ||
| + | |||
| + | <tabbox VIM1S> | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | |||
| + | e.g. To enable '' | ||
| + | |||
| + | ```shell | ||
| + | fdt_overlays=i2cm_e | ||
| + | |||
| + | ``` | ||
| + | |||
| + | After reboot, you will see the I2C device node. | ||
| + | |||
| + | ```shell | ||
| + | $ ls /dev/i2c-4 | ||
| + | /dev/i2c-4 | ||
| ``` | ``` | ||
| </ | </ | ||
| + | |||
| + | ===== I2C Usage ===== | ||
| + | |||
| + | Please check the [[https:// | ||
| ===== Disable I2C to Use GPIO ===== | ===== Disable I2C to Use GPIO ===== | ||
| - | If you want to use normal GPIO instead of I2C, you can remove the I2C node in device tree overlays configration file. | + | If you want to use normal GPIO instead of I2C, you can remove the I2C node in [[products: |