• Ready for review
  • Using I2C in Linux

    Using I2C in Linux

    The Trizeps and Myon CPU modules may be configured to have multiple I2C busses.

    Myon I

    Pins

    IO-Port

    Driver Index

    Description

    Pins

    IO-Port

    Driver Index

    Description

    66,68

    I2C4

    3

    typical connected to touch-controller

    119,121

    I2C6

    5

    I2C devices

    Trizeps VII

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    194,196

    I2C2

    1

    primary I2C interface

    94,96

    I2C1

    0

    secondary I2C interface

    The PMFP0100 PMIC (7-bit address 0x08) of the Trizeps VII is connected to the primary I2C interface.

    Trizeps VIII

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    194,196

    I2C2

    1

    primary I2C interface

    94,96

    I2C1

    0

    secondary I2C interface

    -

    I2C3

    2

    internal I2C interface

    The following devices are attached to the internal I2C interface:

    7bit

    8bit

    Description

    7bit

    8bit

    Description

    0x08

    0x10

    PMFP0100 PMIC

    0x10

    0x20

    MKV11 Kinetis MCU

    0x1A

    0x34

    WM8983 Audio Codec

    0x2C

    0x58

    MIPI to LVDS transceiver

    0x40

    0x80

    FPGA primary config address

    0x41

    0x82

    FPGA primary user mode

    0x42

    0x84

    FPGA secondary user mode

    0x43

    0x86

    FPGA primary config reset

    0x60

    0xC0

    VDD_SOC regulatur

    Trizeps VIII Mini

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    194,196

    I2C2

    1

    primary I2C interface

    94,96

    I2C1

    0

    secondary I2C interface

    -

    I2C3

    2

    internal I2C interface

    The following devices are attached to the internal I2C interface:

    7bit

    8bit

    Description

    7bit

    8bit

    Description

    0x10

    0x20

    MKV11 Kinetis MCU

    0x1A

    0x34

    WM8983 Audio Codec

    0x2C

    0x58

    MIPI to LVDS transceiver

    0x40

    0x80

    FPGA primary config address

    0x41

    0x82

    FPGA primary user mode

    0x42

    0x84

    FPGA secondary user mode

    0x43

    0x86

    FPGA primary config reset

    0x4B

    0x96

    BD71847 PMIC

    Trizeps VIII Plus

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    194,196

    I2C2

    1

    primary I2C interface

    94,96

    I2C1

    0

    secondary I2C interface

    -

    I2C3

    2

    internal I2C interface

    The following devices are attached to the internal I2C interface:

    7bit

    8bit

    Description

    7bit

    8bit

    Description

    0x10

    0x20

    MKV11 Kinetis MCU

    0x1A

    0x34

    WM8983/WM8962B Audio Codec

    0x25

    0x4A

    PCA9450 PMIC

    0x40

    0x80

    FPGA primary config address

    0x41

    0x82

    FPGA primary user mode

    0x43

    0x86

    FPGA primary config reset

    0x4A

    0x94

    WM8962B test functionality

    0x69

    0xD2

    WM8962B test functionality

    0x78

    0xF0

    ???

    Myon II

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    J70-66,68

    I2C2

    1

    primary I2C interface

    J71-67,69

    I2C1

    0

    secondary I2C interface

    J71-19,21

    I2C3

    2

    internal I2C interface

    [J70-73,75]

    I2C4

    3

    special mounting option!

    The following devices are attached to the internal I2C interface:

    7bit

    8bit

    Description

    7bit

    8bit

    Description

    0x1A

    0x34

    WM8983 Audio Codec

    0x2C

    0x58

    MIPI to LVDS transceiver

    0x4B

    0x96

    BD71847 PMIC

    SBCSOM

    Pins

    Port

    Driver Index

    Description

    Pins

    Port

    Driver Index

    Description

    L.A04,A05

    I2C1

    0

    left connector, i-MOD I2C, Mini-PCIe socket

    R.A04,A05

    I2C2

    1

    right connector, camera , KuK-MODIS

    I2C3

    2

    internal I2C interface

    The following devices are attached to the internal I2C interface:

    7bit

    8bit

    Description

    7bit

    8bit

    Description

    0x1A

    0x34

    WM8983 Audio Codec

    0x2C

    0x58

    MIPI to LVDS transceiver

    0x39

    0x72

    HDMI transceiver

    0x49

    0x92

    Secure Element

    0x4B

    0x96

    BD71847 PMIC

    0x50

    0xA0

    EEPROM

    Use I2C from the Command Line

    Please view the man-pages of the commands for details. The below instructions are only for a quick reference. On Debian, these tools are contained in the package i2c-tools. Install it with:

    sudo apt install i2c-tools

    Scan for available I2C devices

    In this example we scan the internal I2C interface of Trizeps VIII.

    $ i2cdetect -y 2

    Which will output:

    0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- 08 -- -- -- -- -- -- -- 10: 10 -- -- -- -- -- -- -- -- -- 1a -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 UU -- 43 -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

    The '-y' option is used to prevent the 'Continue? [Y/n]' question.
    '2' is the Driver-Index of the I2C3 interface.
    The output shows the found I2C-devices. 'UU' indicates that a driver for this device has been loaded. In the above case it is a driver that communicates with the Trizeps VIII FPGA.

    Read from I2C device

    In this example outputs the ID-register of the Trizeps VIII FPGA (depends on FPGA programming):

    The '-f' option forces access to device 0x41. This is used, because a driver for this address has already been loaded and will prevent access without the force option.
    The '-y' option is used to prevent the 'Continue? [Y/n]' question.
    '2' is the Driver-Index of the I2C3 interface.
    '0x41' is the 7bit I2C-address of the Trizeps VIII FPGA. '0' is the ID-register offset.

    Write to I2C device

    This will write to register 0x10 of device connected to 0x41. In this specific case it disables conversion of the MIPI-DSI stream.
    The '-f' option forces access to device 0x41. This is used, because a driver for this address has already been loaded and will prevent access without the force option.
    The '-y' option is used to prevent the 'Continue? [Y/n]' question.
    '2' is the Driver-Index of the I2C3 interface.
    '0x41' is the 7bit I2C-address of the Trizeps VIII FPGA. '0x10' is the display control register.

    Other I2C Commands

    'i2ctransfer' may be used to have better control on how an I2C packet is sent (Multiple bytes write & read).
    'i2cdump' may be used to dump registers of an I2C device.