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-AM57x provides five independent I2C buses at the phyCORE connector directly from the processor. This guide will show you how to test the I2C interface on the phyCORE-AM57x development kit. To learn more information about the phyCORE-AM57x Inter-Integrated Circuit (I2C) interface, please see section 8.3 in the Hardware Manual.

Note

The AM57x processor supports up to 5x I2C interfaces. Only three of these are supported on the phyCORE-AM57x development kit by default but others can be enabled via pin multiplexing.

Available Interfaces

Interface

sysfs Path

I2C1

/dev/i2c-0

I2C3

/dev/i2c-2

I2C4

/dev/i2c-3

Using I2C1

  • Power on the development kit 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.

Target (Linux)
ls /dev/i2c*
Example Output
root@phycore-am57xx-1:~# ls /dev/i2c*
/dev/i2c-0  /dev/i2c-2  /dev/i2c-3
  • 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

Target (Linux)
 i2cdetect -l
Expected Output
root@phycore-am57xx-1:~# i2cdetect -l
i2c-3   i2c             OMAP I2C adapter                        I2C adapter
i2c-2   i2c             OMAP I2C adapter                        I2C adapter
i2c-0   i2c             OMAP I2C adapter                        I2C adapter
  • Use the “i2cdetect” command to scan the I2C1 bus for devices. This command outputs the address of all devices on the I2C1 bus.

    The I2C1 (/dev/i2c-0) interface is heavily utilized on the phyCORE-AM57x development kit. Devices onboard the SOM such as the PMIC, EEPROM and RTC are connected on this bus.

Target (Linux)
i2cdetect -y -r 0
Expected Output
root@phycore-am57xx-1:~# i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- UU UU UU 5b -- -- -- --
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 I2C1 on the development kit.

I2C1 Reserved Addresses

Interface

Address (7-bit)

PMIC

0x58

0x59

0x5A

0x5B

EEPROM

0x50

RTC

0x68

Interacting with I2C1

The I2C1 (/dev/i2c-0) interface is heavily utilized on the phyCORE-AM57x development kit. Devices onboard the SOM such as the PMIC, EEPROM and RTC are connected on this bus.

  • Use i2cdetect from Linux to scan the bus for devices:

    Target (Linux)
    i2cdetect -y -r 0
    
  • This command outputs the address of all devices on the I2C1 bus. You should see something similar to the below:

    Example Output
    root@am57xx-phycore-kit:~# i2cdetect -y -r 0
        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: UU -- -- -- -- -- -- -- UU UU UU 5b -- -- -- --
    60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    

    Note

    UU indicates that the address is connected to a driver. You will be unable to talk to this device via i2c commands i2cset and i2cget.