Skip to content

I2C

Available I2C buses

List of available I2C buses:

# ls -l /dev/i2c-*
crw------- 1 root root 89, 0 Feb 22 07:00 /dev/i2c-0
crw------- 1 root root 89, 1 Feb 22 07:00 /dev/i2c-1
crw------- 1 root root 89, 2 Feb 22 07:00 /dev/i2c-2
crw------- 1 root root 89, 3 Feb 22 07:00 /dev/i2c-3
crw------- 1 root root 89, 5 Feb 22 07:00 /dev/i2c-5
crw------- 1 root root 89, 6 Feb 22 07:00 /dev/i2c-6

System class:

# ls /sys/class/i2c-dev/
i2c-0  i2c-1  i2c-2  i2c-3  i2c-5  i2c-6

I2C devices per bus

Scan bus 0:

# i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: UU -- -- -- -- UU -- -- -- -- -- -- -- -- UU -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- UU 52 53 -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 1:

# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- 54 55 -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 2:

# i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 3:

# i2cdetect -y -r 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: UU UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: UU UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 5:

# i2cdetect -y -r 5
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 6:

# i2cdetect -y -r 6
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: 30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

When the device is marked with "UU" it means that a driver is using it.
When the device is marked with numbers it means that no driver is using it.

Reading / Writing from an I2C device

Variscite includes I2CTools as a part of the default file system build, examples of optional commands:
i2cdump - dump the content of an I2C device
i2cset - write a single character to an I2C device
i2cget - read a single character to an I2C device

In addition follow 'C' code example as describe in the linux kernel documentation : https://www.kernel.org/doc/Documentation/i2c/dev-interface

Variscite's system integrated I2C devices

Note: Do not write to Variscite's on-SOM EEPROM or you will damage the SOM!

Variscite devices on VAR-SMARC-MX8M-PLUS:

I2C-0 0x1a - Audio codec on SOM
I2C-0 0x20 - PCAL6416 GPIO expander on SOM
I2C-0 0x25 – PMIC on SOM
I2C-0 0x2E – ST33KTPM2I TPM 2.0 on SOM
I2C-0 0x51 – PCF85263A RTC on SOM
I2C-0 0x52 - Lower EEPROM on SOM. Don't modify!
I2C-0 0x53 - Upper EEPROM on SOM. Don't modify!

I2C-1 0x54 - Lower EEPROM on carrier board
I2C-1 0x55 - Upper EEPROM on carrier board
I2C-1 0x3D - USB Type C on carrier board

I2C-2 0x3c – MIPI-CSI camera on expansion board

I2C-3 0x1a - Audio codec on carrier board
I2C-3 0x20 - PCAL6408 GPIO expander1 on carrier board
I2C-3 0x21 - PCAL6408 GPIO expander2 on carrier board
I2C-3 0x38 – Capacitive touch controller on kit display
I2C-3 0x50 - Lower GP EEPROM on SOM
I2C-3 0x55 - Upper GP EEPROM on SOM

I2C-5 0x3c – MIPI-CSI camera on expansion board