Debugging I2C GPIO
Perform the following steps to debug I2C:
-
Execute the following command to scan the bus:
i2cdetect -lResult:Figure 1. Example Output
-
Execute the following command to detect the device:
i2cdetect -y -r 0Tip:0 is the I2C bus number.
Result: In this figure, the detected devices areFigure 2. Example Output
0x29,0x48,0x5c,0x68, and0x70. -
Execute the following command to read register content:
i2cget -f -y 0 0x5c 0x0fTip:-
0: I2C bus number -
0x5c: I2C device address -
0x0f: Memory address
Result:Figure 3. Example Output
The register content is 0xb1 in this output.
-
-
Execute the following command to write register data:
i2cset -y 0 0x5c 0x11 0x10Tip:-
0: I2C bus number. -
0x5c: I2C device address. -
0x11: Memory address. -
0x10: The content to be written in the register.
-
-
Execute the following to read all register values:
i2cdump -y 0 0x5cTip:-
0: I2C bus number -
0x5c: I2C device address
Result:Figure 4. Example Output
-
