This is an old revision of the document!
This document mainly introduces the usage of I2C bus on 40-Pin Header.
I2C | PIN & GPIO(#number) | DT Overlays Node | Bus Number | Device Node | |
---|---|---|---|---|---|
VIM1/2 | I2C A | SCL(22) - GPIODV_25 (#474) SDA (23) - GPIODV_24 (#473) | i2c0 | 0 | /dev/i2c-0 |
I2C B | SCL(25) - GPIODV_27 (#476) SDA(26) - GPIODV_26 (#475) | - | 1 | /dev/i2c-1 | |
VIM3/3L | I2CM 3 | SCL(22) - GPIOA_15 (#475) SDA(23) - GPIOA_14 (#474) | i2c3 | 3 | /dev/i2c-3 |
I2C AO | SCL(25) - GPIOAO_2 (#498) SDA(26) - GPIOAO_3 (#499) | - | 4 | /dev/i2c-4 | |
VIM4 | I2CM F | SCL(22) - GPIOY_17 (#501) SDA (23) - GPIOY_18 (#502) | i2cm_f | 5 | /dev/i2c-5 |
I2CM A | SCL(25) - GPIOT_20 (#466) SDA(26) - GPIOT_21 (#467) | i2cm_a | 0 | /dev/i2c-0 |
In order to use the I2C, you need to enable the I2C function via Device Tree Overlay.
Edit /boot/env.txt
to add the i2c node to overlays
node if it doesn't exist.
Take VIM3 as an example to enable I2CM 3
, you need to add i2c3
node to overlays
node if it doesn't exist.
overlays=uart4 pwm_ao_a pwm_f i2c3
After reboot, you will see the I2C device node.
$ ls /dev/i2c-3
/dev/i2c-3
Edit /boot/dtb/amlogic/kvim4.dtb.overlay.env
to add i2c node to fdt_overlays
node if it doesn't exist.
e.g. Enable I2CM A
, you need to add i2cm_a
to node fdt_overlays
if it doesn't exist.
fdt_overlays=i2cm_a
After reboot, you will see the I2C device node.
$ ls /dev/i2c-0
/dev/i2c-0
If you want to use normal GPIO instead of I2C, you can remove the I2C node in device tree overlays configration file.