This guide will show you how to access the I2C interface with ADB command.
Connections
I2C ASensor SCL
<-> I2C_SCK_A (PIN 22)
Sensor SDA
<-> I2C_SDA_A (PIN 23)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C BSensor SCL
<-> I2C_SCK_B (PIN 25)
Sensor SDA
<-> I2C_SDA_B (PIN 26)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C ASensor SCL
<-> I2C_SCK_A (PIN 22)
Sensor SDA
<-> I2C_SDA_A (PIN 23)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C BSensor SCL
<-> I2C_SCK_B (PIN 25)
Sensor SDA
<-> I2C_SDA_B (PIN 26)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C 3Sensor SCL
<-> I2C0_SCK (PIN 22)
Sensor SDA
<-> I2C0_SDA (PIN 23)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C 4Sensor SCL
<-> I2C1_SCK (PIN 25)
Sensor SDA
<-> I2C1_SDA (PIN 26)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C ASensor SCL
<-> I2C1_SCK (PIN 25)
Sensor SDA
<-> I2C1_SDA (PIN 26)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
I2C FSensor SCL
<-> I2C0_SCK (PIN 22)
Sensor SDA
<-> I2C0_SDA (PIN 23)
Sensor GND
<-> GND
Sensor VCC
<-> 5V or 3.3V
//depends on external device power requirement
Device Detection
Detect device on I2C A
:
1 | # i2cdetect -y -r 1 |
Detect device on I2C B
:
1 | # i2cdetect -y -r 2 |
If the wiring is correct and the connected sensor is functioning normally, then you will see the address of the connected device, such as: 0x1d
, 0x18
and 0x51
.
Detect device on I2C A
:
1 | # i2cdetect -y -r 1 |
Detect device on I2C B
:
1 | # i2cdetect -y -r 2 |
If the wiring is correct and the connected sensor is functioning normally, then you will see the address of the connected device, such as: 0x1d
, 0x18
and 0x51
.
Detect device on I2C 3
:
1 | # i2cdetect -y -r 3 |
Detect device on I2C 4
:
1 | # i2cdetect -y -r 4 |
If the wiring is correct and the connected sensor is functioning normally, then you will see the address of the connected device, such as: 0x0e
and 0x22
.
Detect device on I2C A
:
1 | # i2cdetect -y 0 |
Detect device on I2C F
:
1 | # i2cdetect -y 5 |
Read the Value of the Device Register
Read the device connected to the I2C A
bus, whose device address is 0x1d
and register address is 0x0d
.
1 | # i2cget -f -y 1 0x1d 0x0d |
Read the device connected to the I2C A
bus, whose device address is 0x1d
and register address is 0x0d
.
1 | # i2cget -f -y 1 0x1d 0x0d |
Read the device connected to the I2C 3
bus, whose device address is 0x1d
and register address is 0x0d
.
1 | # i2cget -f -y 3 0x1d 0x0d |
Read the device connected to the I2C A
bus, whose device address is 0x1d
and register address is 0x0d
.
1 | # i2cget -y 0 0x1d 0x0d |
NoteExecuting ADB commands require root privileges
For more information, please refer to the I2C tool documentation.