7 i2c bus interface sub command set – IBASE IBD185 User Manual

Page 14

Advertising
background image

14 IBD185 User Guide

1.3.7 I2C Bus Interface Sub Command Set

This command set is a subset of the IB protocol command.

It provides an interface for HOST to control the I2C bus master on

DEVICE side.

The sub command set is constructed by a specific command ID

(I2C_API_COMMAND) in “Command” field of packet, and the payloads

are embedded in “Data” field.

Header Size Command

Data

CRC

2 bytes 1 byte

1 byte

0 – 64 bytes

2 bytes

Sub Command

Length

Sub Command

Code

Sub Command

Data

1 byte

1 byte

0 – 32 bytes

The supported command of I2C bus interface command set list below:

Code Symbol

Description

0x01

I2CAPI_BUS_INIT

Initial the specific I2C bus master

0x02 ---

reserved

0x03 I2CAPI_BUS_ENABLE

Enable/Disable the specific I2C bus

0x04

I2CAPI_DEV_STATUS

Detect the slave status on the

specific I2C bus.

0x05

I2CAPI_DEV_READ

Perform I2C device read operation

0x06

I2CAPI_DEV_WRITE

Perform I2C device write operation

0x07

I2CAPI_BUS_RESET

Reset the specific I2C bus

0x08 ---

reserved

Here is a simple illustration of the interface functions in pseudo code.

I2C_Bus_Init(BusID,Speed);

I2C_Bus_Enable(BusID,Enabled);

I2C_Device_Detect(BusID,SlvAddr);

I2C_Device_Read(BusID,SlvAddr,CmdLen,CmdCode[8],Flag,DatLen,

DatBuff[32]);

I2C_Device_Write(BusID,SlvAddr,CmdLen,CmdCode[8],Flag,DatLen,

DatBuff[32]);

I2C_Bus_Reset(BusID,Flag);

Sub Command Set

Advertising