The i2c utility provides low level access to the I2C bus on any NVIDIA® switch platform, enabling the user to read or write data.
i2c Usage (Advanced Users)
The mst driver must be started prior to running i2c tool.
To start i2c:
- Start the mst driver (mst start or mst restart). Note: This step in not required in Windows.
Run i2c with the following command line syntax:
# i2c [OPTIONS] <device> <cmd> <i2c_addr> <addr> [<data>]
where:
-h | Prints this message. |
-a <addr_width> | Sets address width (in bytes) to the specified value. May be 0, 1, 2 or 4. Default: 1. |
-d <data_width> | Sets data width (in bytes) to the specified value. May be 1, 2 or 4s. Default is 1. |
-x <data_len> | Presents each byte of data as two hexadecimal digits (such as 013C20343B). Note that this option is mutually exclusive with the "-d" option. |
The remaining parameters are:
<device> | Valid mst device. |
<cmd> | Command. May be "r[ead]" or "w[rite]". |
<i2c_addr> | I2C slave address. |
<addr> | Address (of length addr_width) inside I2C target device to read/write operation. |
<data> | Data (bytes of length data_width) to write to target device. |
All parameters are interpreted as hexadecimal values.
Examples:
Read two bytes from address 0 of target I2C slave address 0x56:
# i2c -a 2 -d 2 /dev/mst/mtusb-1 r 0x56 0x00 0000
Write two bytes to the address above then read them:
# i2c -a 2 -d 2 /dev/mst/mtusb-1 w 0x56 0x00 0x1234 # i2c -a 2 -d 2 /dev/mst/mtusb-1 r 0x56 0x00 3412
Read (as separate) 16 bytes in hexadecimal format starting from address 0 of the target device above:
# i2c -a 2 -x 16 /dev/mst/mtusb-1 r 0x56 0x00 12340000000000000000000000000000
Exit Return Values
The following exit values are returned:
- 0 - successful completion
- >0 - an error occurred