I2c bus initialize – IBASE IBD185 User Manual

Page 15

Advertising
background image

IBD185 User Guide

15

I2C Bus Initialize

Initialize the I2C bus master on MCU.

Start up an I2C bus with specific Bus ID and Speed.

The Bus ID can be 1 or 2.

Bus ID is 1 means the I2C1 on MCU, and so on.

The Speed can be 0, 1, 2.

Speed=0 means de-initialize the I2C Bus.

Speed=1 means initialize the specific I2C Bus in 400Kbps.

Speed=2 means initialize the specific I2C Bus in 100Kbps (default).

Sub Command Request

Sub

Command

Length

Sub Command

Code

Sub Command

Data

size of the

I2cApiBusInit

structure

I2CAPI_BUS_INIT I2cApiBusInit structure

Sub Command Reply

Sub

Command

Length

Sub Command

Code

Sub Command

Data

size of the

I2cApiBusInit

structure +1

I2CAPI_BUS_INIT I2cApiBusInit structure followed by

one byte I2cApiResult

The reply packet contains the parameters that device received and

followed by one byte of result.

I2cApiResult = 0 means the execution result is fail.

I2cApiBusInit Structure

Field Type

Description

Bus ID

byte

Designate which I2C bus on MCU

1 – 1st I2C bus master

2 – 2nd I2C bus master

Bus Speed

byte

I2C bus speed selection

0: De-Initialize the specific I2C bus

1: 400Kbps

2: 100Kbps (default)

Advertising