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 |
---|---|---|---|---|
I2CM 3 | SCL - PIN22 - GPIOA_15 (#475) SDA - PIN23 - GPIOA_14 (#474) | i2c3 | 3 | /dev/i2c-3 |
I2C AO | SCL - PIN25 - GPIOAO_2 (#498) SDA - PIN26 - GPIOAO_3 (#499) | - | 4 | /dev/i2c-4 |
I2C | PIN & GPIO Number | DT Overlays Node | Bus Number | Device Node |
---|---|---|---|---|
I2CM 3 | SCL - PIN22 - GPIOA_15 (#475) SDA - PIN23 - GPIOA_14 (#474) | i2c3 | 3 | /dev/i2c-3 |
I2C AO | SCL - PIN25 - GPIOAO_2 (#498) SDA - PIN26 - GPIOAO_3 (#499) | - | 4 | /dev/i2c-4 |
I2C | PIN & GPIO Number | DT Overlays Node | Bus Number | Device Node |
---|---|---|---|---|
I2CM F | SCL - PIN22 - GPIOY_17 (#501) SDA - PIN23 - GPIOY_18 (#502) | i2cm_f | 5 | /dev/i2c-5 |
I2CM A | SCL - PIN25 - GPIOT_20 (#466) SDA - PIN26 - 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.
Take VIM3 as an example to enable i2c3
:
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.
e.g. Enable I2CM A
, you need to add i2cm_a
to node fdt_overlays
.
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.