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-AM64x 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-Electra AM64x. To learn more information about the phyCORE-AM64x I2C interface, please see the I2C section in the Hardware Manual.

Note

The AM64x processor supports up to 6x I2C interfaces. Only two of these are supported on the phyBOARD-Electra AM64x by default but others can be enabled via pin multiplexing.

I2C Settings

Hardware Interface

sysfs Path

I2C0

/dev/i2c-0

I2C1

/dev/i2c-1

Using I2C0

  • Power on the phyBOARD-Electra AM64x 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.

List I2C devices
sh-phyboard-electra-am64xx-2:~# 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

List I2C buses
sh-phyboard-electra-am64xx-2:~# 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.

Scan I2C0 bus
sh-phyboard-electra-am64xx-2:~# 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: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
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.

I2C0 addresses

Interface

Address (7-bit)

EEPROM

0x50

RTC

0x52

EEPROM identification page

0x58

PMIC

0x61

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.