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 phyCORE-AM62x provides six independent multimaster fast-mode I2C modules. Aside from I2C0, which has pullups on the SOM, all the I2C signals require pullups in your custom carrier board design. This guide will show you how to test the I2C interface on the phyBOARD-Lyra AM62x. To learn more information about the phyCORE-AM62x I2C interface, please see the I2C section in the Hardware Manual.
Note
The AM62x processor supports up to 6x I2C interfaces. Only two of these are supported on the phyBOARD-Lyra AM62x by default but others can be enabled via pin multiplexing.
Hardware Interface |
sysfs Path |
---|---|
I2C0 |
/dev/i2c-0 |
I2C1 |
/dev/i2c-1 |
Using I2C0
Power on the phyBOARD-Lyra AM62x and boot into Linux.
List the available I2C devices. There will be a few devices that appear in /dev/ and each is a different I2C interface.
phyboard-lyra-am62xx-3:~# ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1 /dev/i2c-2
Note
The Linux Kernel is currently enumerating an extra I2C interfaces available at the hardware level even though only two are setup. Attempting to work with the I2C interfaces other than I2C0 and I2C1, using the default software, will give you errors.
List all the I2C busses in the system.
The i2c-tools package contains a heterogeneous set of I2C tools to interact with I2C slave devices from userspace. BSP images have i2c-tools packaged by default
phyboard-lyra-am62xx-3:~# i2cdetect -l
i2c-0 i2c OMAP I2C adapter I2C adapter
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c i2c-1-mux (chan_id 0) I2C adapter
Use the “i2cdetect” command to scan the I2C0 bus for devices. This command outputs the address of all devices on the I2C0 bus.
phyboard-lyra-am62xx-3:~# i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
u0: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- UU -- -- -- -- -- 58 -- -- -- -- -- -- --
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 detected interfaces should match with the devices connected to I2C0 on the development kit.
Interface |
Address (7-bit) |
---|---|
PMIC |
0x30 |
EEPROM |
0x50 |
RTC |
0x52 |
EEPROM identification page |
0x58 |
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.