This page shows the basic usage of the I2C bus.
the following examples are using an external GPIO expander.
i2cdetect
is used to identify available I2C devices on a given I2C bus. An overview of the available I2C busses can be achieved by using i2cdetect -l
--
: No device found
21
: There is a device on address 0x21
UU
: A Linux driver is currently using this device
Syntax: i2cdetect [options] <busNr>
The ì2cdump
operation is good tool to see the content of a given I2C device to get a better overview of the stored data in its registers.
Syntax: i2cdump [options] <busNr> <deviceAddress>
i2cget
is used for reading a byte value from a given device I2C register address.
Syntax: i2cget [options] <busNr> <deviceAddress> <register> <address>
i2cset
is used for writing a byte value to a given device I2C register address.
Syntax: i2cset [options] <busNr> <deviceAddress> <register> <address> <value>