I2C
I²C or I2C (Inter-IC) is a synchronous, multi-controller/multi-target (controller/target), packet switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors.
It is used by many hardware boards to communicate with general purpose I/O (GPIO) devices.
A similar extension of I2C is SMBus which is more specifically used for hardware monitoring purposes.
Installation
I2C kernel modules already exist in most default kernel packages.
Userspace tools can be installed from i2c-tools. Bleeding edge is on i2c-tools-gitAUR.
SMBus-specific tools can be installed from lm_sensors.
Module loading
Since i2c-tools version 4.4-3, the i2c-dev module is registered to be automatically loaded at boot.
However, in some system configurations it might be required to manually register the module to load at boot:
/etc/modules-load.d/i2c-dev.conf
i2c-dev
Depending on the system configuration, other hardware-specific modules such as i2c-i801 or i2c-smbus might need to be loaded as well.
To check if the module has been loaded properly, check for the presence of the relevant devices:
$ ls /dev/i2c*
Permission for using the /dev/i2c-* devices can be granted by adding your user account to the i2c user group.
Usage
i2cdetect can detect all the active I2C devices:
$ i2cdetect -l
i2c-0 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-1 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-2 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-3 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-4 smbus SMBus I801 adapter at f040 SMBus adapter i2c-5 i2c i915 gmbus dpb I2C adapter i2c-6 i2c i915 gmbus dpc I2C adapter i2c-7 i2c i915 gmbus misc I2C adapter i2c-8 i2c AUX B/DDI B/PHY B I2C adapter
When an I2C device is connected to a known bus, i2cdetect can probe it for active addresses:
$ i2cdetect 1
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
Be wary that this program can confuse your I2C bus, cause data loss and worse.