USERI2CREAD

Read data from devices on the I2C bus

Platform:

OEM7600, OEM7700, OEM7720

Use this command to read data from devices on the I2C bus.

This command only applies to OEM7 receivers that have I2C signals available on the interface connector. The compatible receivers are listed in the Platform section above.

The USERI2CRESPONSE log can be used to check the completion or status of the read operation. An optional user defined Transaction ID can be provided to help synchronize requests with responses in the USERI2CRESPONSE log. This command is primarily intended to be used by Lua applications that need to interact with external devices.

Reading from an I2C device requires a device address, to distinguish which physical device is to be accessed, a register within the device, and the expected number of bytes to be read. Depending on the type of I2C device, register addresses can be 1 to 4 bytes in length, so the actual number of bytes for the register address must be specified.

For some I2C devices there are no registers within the device. In this case, the Register Address Length is 0 and no bytes are supplied for the Register Address.

The USERI2CREAD command is flexible to handle all of these situations.

Message ID: 2232

Abbreviated ASCII Syntax:

USERI2CREAD DeviceAddress RegisterAddressLen RegisterAddress RequestReadLen [TransactionID]

Examples:

USERI2CREAD 70 1 AB 12 1234

USERI2CREAD 74 3 ABCDEF 234 5678

USERI2CREAD 74 0 234 5678

Field

Field Type

Description

Format

Binary Bytes

Binary Offset

1

Command header

USERI2CREAD header

This field contains the command name for abbreviated ASCII or the message header for ASCII (see page 1) or Binary (see page 1).

-

H

0

2

DeviceAddress

The 7 bit address of the I2C device. Valid values are 0 through 127.

For ASCII and Abbreviated commands, this field is a hexadecimal string of two digits. There is no 0x prefix and spaces are not allowed in the string.

Uchar

11

H

3

RegisterAddressLen

The length of the register address that follows. Valid values are 0 through 4.

Ulong

4

H+4

4

RegisterAddress

The actual address of the register to be read. The number of bytes here must match the RegisterAddressLen. In particular, when RegisterAddressLen is 0, this field is empty (even for a binary command)

For ASCII and Abbreviated commands, this field is a hexadecimal string of two digits for each byte in the register address. There is no 0x prefix and spaces are not allowed in the string.

Uchar Array

X1

H+8

5

RequestReadLen

The length of data expected to be retrieved from the device. Valid values are 1 through 256.

Ulong

4

H+122

6

TransactionID

An optional user provided ID for this transaction. Default = 0.

This transaction ID will be copied to the USERI2CRESPONSE log created for this read operation.

Ulong

4

H+163