5.1.3 I2C_Read Command and its Response

The I2C_Read command (0x48) initiates an I2C read transaction. The command reads wRdDtLen bytes of data from the I2C client device addressed by bAddress.

This command is sent through Endpoint 0x03 (OUT) and the response is read through Endpoint 0x83 (IN).

Depending on the requested read length, multiple response packets may be returned. The first response may contain up to 60 data bytes and subsequent response packets may contain up to 62 data bytes each.

Table 5-7. I2C_Read - Command
SI. No.Byte IndexCommandDescription
100x48Command codeInitiates the I2C read transaction
21bAddressI2C client address7-bit I2C client address
32L(wRdDtLen)Read data length (lower byte)Number of data bytes; maximum length 65535 bytes
43H(wRdDtLen)Read data length (upper byte)
5Wait for the first response from the MCP2222 to determine whether the command is accepted
6If accepted, continue reading until the required number of bytes are read or until a failure occurs.
Table 5-8. I2C_Read - First Response
Byte IndexFirst ResponseDescription
00x48Return command codeReturns whether the I2C_Read command was accepted.
1

0x22

0x60

0x64

Accepted – initiated

Rejected – wrong parameters

Rejected – I2C is busy

The command is accepted and the read transaction is initiated.

The command is rejected because the parameters are invalid.

The command is rejected because the I2C module is busy.

Table 5-9. I2C_Read - Second Response
Byte IndexSecond ResponseDescription
00x48Return command codeThe I2C read is continued.
10x21Read is continued
0x80Failure - address NACKAn address NACK was received. Verify the I2C client address.
0x88Failure - clock-stretch timeoutA clock-stretch timeout occurred. Recover the bus and retry, if required.
0x8CFailure - arbitration lostBus arbitration was lost; another I2C host may be using the bus.
0x90Failure - an I2C bus error occurredA bus error occurred.
2L(wRdDtLen)Data length (lower byte)Number of data bytes to be read (maximum 65,535 bytes).
3H(wRdDtLen)Data length (higher byte)
4b0(vDatPac)First data byteThe first 60 data bytes are read
5b1(vDatPac)Second data byte
......
63b59(vDatPac)The 60th data byte
Table 5-10. I2C_Read - Subsequent Responses
Byte IndexSubsequent ResponsesDescription
00x48Return command codeThe I2C_Read is continued
10x21Read is continued
0x88Failure - clock-stretch timeoutA clock-stretch timeout occurred. Recover the bus and retry, if required.
0x8CFailure - arbitration lostBus arbitration was lost
0x90Failure - an I2C bus error occurredA bus error occurred
2b60(vDatPac)The 61st data byteThe next 62 data bytes are read
...
63b121(vDatPac)The 122nd data byte
Repeat the subsequent response sequence until all requested bytes have been received or an error occurs.