I2C Interface
1. I2C Pins
There are two groups of I2C available on the 40PIN pins, namely i2c-5 and i2c-8.

| I2C | Pin | Function |
|---|---|---|
| I2C5-SCL | 27 | I2C5 clock signal line |
| I2C5-SDA | 28 | I2C5 data line |
| I2C8-SCL | 3 | I2C8 clock signal line |
| I2C8-SDA | 5 | I2C8 data line |
2. I2C Interface Enable
These two interfaces can be enabled by modifying the device tree.
&i2c5{
status = "okay";
};
&i2c8{
status = "okay";
};3. Mount I2C Device
When registering an I2C device, you need the i2c_client structure to describe the I2C device. However, in standard Linux, users only need to provide corresponding I2C device information, and Linux will construct the i2c_client structure based on the provided information.
The I2C device information provided by users is written as nodes in the DTS file, as follows:
&i2c5{
nca9555:nca9555@20{
reg=<0x20>;
compatible = "novosense,nca9555";
status="okay";
gpio-controller;
#gpio-cells = <2>;
};
};The driver mounts the device by obtaining node information from DTS.
Note
NCA9555 is a 24-pin CMOS device that provides 16-bit general parallel I2C bus input/output GPIO expansion function.
4. Check I2C Device
Use the following command to check if the i2c bus is enabled.
As shown in the figure:

5. I2C Testing Tools
The board comes with i2c testing commands: i2cdetect, i2cdump, i2cset, and i2cget. They are used to scan devices on the I2C bus, read/write registers of specified devices, etc.
For example, to view the device situation mounted on i2c5, the output is as follows:
# i2cdetect -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --Tips
"15" indicates a device with address 15 but the driver is not loaded. UU indicates a device with address 50 and the driver has been loaded successfully.
Other common command usage examples are as follows:
# Check how many i2c buses the current system has
i2cdetect -l
# View devices on i2c-3 interface
i2cdetect -a 3
# Read all register values of the specified device.
i2cdump -f -y 3 0x20
# Read the value of a specific register of the specified I2C device, e.g., read register 0x01 from device at address 0x68.
i2cget -f -y 3 0x20 0x01
# Write a value to a specific register of the specified I2C device, e.g., set register 0x01 of device at address 0x68 to 0x6f.
i2cset -f -y 3 0x20 0x01 0x6f b