I2C
This guide will show you how to test the I2C interface on the phyCORE-i.MX8X development kit.
Note
The phyCORE-i.MX8X SOM supports up to 9x I2C interfaces by default.
Only four of these are supported on the phyCORE-i.MX8X carrier board and three of those four are reserved for specific interfaces (2x for the MIPI display 1x for the MIPI camera interfaces).
Interface |
Sysfs Path |
---|---|
CSI0_I2C0 |
/dev/i2c-16 |
DSI0_I2C0 |
/dev/i2c-17 |
DSI1_I2C0 |
/dev/i2c-18 |
I2C1 |
/dev/i2c-19 |
Requirements
Female to Female Jumper Wires
I2C device ( Accelerometer )
Hardware Setup
I2C Device Signal |
Carrier Board Signal |
Carrier Board Connector-Pin |
---|---|---|
VCC |
VCC_3V3 |
X60 - Pin 1 |
SCL |
X_I2C1_SCL |
X59 - Pin 7 |
SDA |
X_I2C1_SDA |
X59 - Pin 8 |
GND |
GND |
X59 - Pin 9 |
Warning
Be sure that the development kit is powered off when connecting the I2C device.
Using I2C1
Power on the development kit and boot into Linux.
List the available I2C devices. There will be a few devices that pop up but /dev/i2c-19 corresponds to the I2C1 interface.
ls /dev/i2c*
/dev/i2c-16 /dev/i2c-17 /dev/i2c-18 /dev/i2c-19
Use the “i2cdetect” command to scan the bus for devices. This command outputs the address of all devices on the I2C1 bus.
Note
UU indicates that the device connected is tied to a kernel driver and you will be unable to communicate with the device via i2c commands (i2cset and i2cget).
i2cdetect -y -r 16
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU UU -- -- -- -- -- -- 59 -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The detected interfaces should match with the devices connected to I2C1 on the development kit.
Interface |
Address (7-bit |
---|---|
GPIO Expander |
0x20 |
USB-C Controller |
0x3F |
EEPROM |
0x51, 0x59 |
RTC |
0x52 |
Audio |
0x0A |
Note
The EEPROM M24C32 has two different addresses (0x51 and 0x59) but one has been reserved in the device tree.