I2C
The Inter-Integrated Circuit (I2C) interface is a two-wire, bidirectional serial bus that provides a simple and efficient method for data exchange among devices. The phyFLEX-AM62Px provides independent multimaster fast-mode I2C modules. This guide will show you how to test the I2C interface on the phyFLEX-Libra AM62Px.
Note
Only a subset of I2C interfaces are supported on the phyFLEX-Libra AM62Px by default but others can be enabled via pin multiplexing.
Hardware Interface |
sysfs Path |
|---|---|
WKUP_I2C0 |
/dev/i2c-1 |
I2C0 |
/dev/i2c-2 |
I2C1 |
/dev/i2c-3 |
I2C2 |
/dev/i2c-4 |
Scanning the I2C Buses
Power on the phyFLEX-Libra AM62Px and boot into Linux.
List the available I2C devices. Each
/dev/i2c-*entry corresponds to one of the I2C interfaces in the table above.
am62pxx-phyflex-libra-rdk-1:~# ls /dev/i2c*
Use the
i2cdetectcommand to scan each bus for devices. WKUP_I2C0 carries the SOM’s own devices (PMIC, VDD_CORE regulator, EEPROM, RTC). I2C0, I2C1 and I2C2 carry the carrier-board peripherals.
am62pxx-phyflex-libra-rdk-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: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- UU -- -- -- -- -- 58 -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
am62pxx-phyflex-libra-rdk-1:~# i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- UU -- -- -- -- -- -- -- -- -- 2b -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU UU -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
am62pxx-phyflex-libra-rdk-1:~# i2cdetect -y -r 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- 47 -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- 62 -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
am62pxx-phyflex-libra-rdk-1:~# i2cdetect -y -r 4
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Note
UU indicates that the device with that particular address is tied to a kernel driver and you will be unable to communicate with the device via i2c commands (i2cset and i2cget).
The devices on each bus correspond to:
Interface |
Address (7-bit) |
|---|---|
PMIC TPS65219 (U6) |
0x30 |
VDD_CORE Regulator TPS62870 (U7) |
0x40 |
SOM EEPROM M24C32 (U8) |
0x50 |
SOM EEPROM M24C32 (U8), identification page |
0x58 |
RTC RV-3028-C7 (U11) |
0x52 |
Interface |
Address (7-bit) |
|---|---|
GPIO Expander TCAL6416 (U58) |
0x21 |
USB PD Controller STUSB4500 (U1) |
0x2B |
Factory EEPROM M24C02 (U57) |
0x51 |
User EEPROM M24C02 (U80) |
0x52 |
Interface |
Address (7-bit) |
|---|---|
GPIO Expander TCAL6416 (U72) |
0x21 |
USB-C Mux HD3SS3220 (U66) |
0x47 |
RGB LED Controller PCA9633 (U55) |
0x62 |
RGB LED Controller PCA9633 (U55), All Call address |
0x70 |
Interface |
Address (7-bit) |
|---|---|
Temperature Sensor P3T1750 (U56) |
0x4F |
Camera, display and SFP+ modules connected to the phyFLEX-Libra AM62Px add further devices to I2C0, I2C1 and MCU_I2C0.
Note
The list of visible I2C devices in your output may differ from what is shown above. This is because our System on Modules (SoMs) come in different variants, and some devices (like the RTC) are optional depending on the specific variant you are using.
Temperature Sensor
The phyFLEX-Libra AM62Px features an NXP P3T1750 digital temperature sensor (U56) on I2C2 (/dev/i2c-4, address 0x4F). It measures the temperature of the carrier board. Linux exposes the sensor through the hardware monitoring (hwmon) subsystem. For the temperature sensors inside the AM62Px processor, see Thermal Zone.
Each hwmon device has a
nameattribute. Find the hwmon device that belongs to the P3T1750:am62pxx-phyflex-libra-rdk-1:~# grep -l p3t1755 /sys/class/hwmon/hwmon*/name
Read the temperature from the
temp1_inputattribute of that hwmon device (replacehwmonXwith the device found above):am62pxx-phyflex-libra-rdk-1:~# cat /sys/class/hwmon/hwmonX/temp1_input
The value is in millidegrees Celsius. For example, a value of 32125 means 32.125°C.
The driver also provides the
temp1_maxandtemp1_max_hystattributes, which set the sensor’s over-temperature limit and hysteresis (also in millidegrees Celsius).