Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Smart Bluetooth

Anonymous
Not applicable

how can i use to i2c between bmi160 sensor and BCM20732(EV Board)?

Development Environment: WICED-Smart-SDK 1.1

BMI 160 connection
- Power : 1.8V power line connected to VDD, VDDIO of bmi160 sensor
- I2C :  R5, R4 connection
- Interrupt pin : P25, P24 connection

I was refer to i2c_temperature_sensor simple source and "WICED-Smart-Hardware-Interfaces.pdf"  for bmi160 sensor I2C implementation.
I ues cfa_bsc_OpExtended function for I2C.
I saw the message(No slave device with this address exists on the I2C bus.).
bmi160 sensor i2c address is 0x68.
Our hw team say that sensor connection is no problem.
but i can not use cfa_bsc_OpEtended function for i2c.
cfa_bsc_OpEtended function normally operated when i use I2C address of EEPROM(0xA1,0xA0).
I need  additional work for I2C when I added device(bmi160 sensor)?

0 Likes
1 Solution
Anonymous
Not applicable

i2cm API should work.

i2cm_init();

i2cm_setSpeed(I2CM_SPEED_400KHZ);

i2cm_setTransactionSpeed();

i2cm_read();

You can refer below thread.

"I2cm_ ***" draw at asking for a description.

View solution in original post

16 Replies
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

When you say slave address is 0x68, is this the 7 bit control address? If it is, can you try 0xD0 as the slave address parameter to the cfa_* API?

0 Likes
Anonymous
Not applicable

I agree with arvinds.

And please check SDO (pin#1; address select) of BMI160.

0 Likes
Anonymous
Not applicable

0xd0, 0x68 did not operate.

when i use 0xD0 or 0x68,retrun value of cfa_*api is 3"No slave device with this address exists on the I2C bus".

SDO is connected with GND(Depending on BMI160 DATASHEET).

please could you recommend another check point?

thanks.

0 Likes
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

Did you try tracing the I2C lines on an oscope or a logic analyzer to see if the right address is on the bus and the slave is acking it?

0 Likes
Anonymous
Not applicable

connected power line is ok(1.8 volt)

slave address is ok(i see bmi160 datasheet and source code(bmi160 linux drive code).)

What is checking point at I2C line?

current of I2C line is always on?

thank you.

0 Likes
Anonymous
Not applicable

Both SCL and SDA should be high before I2C communication.

20732 sends start bit and slave address with w/r bit first.

You can check whether BMI160 sends ack by oscilloscope.

Anonymous
Not applicable

I2C line connection is ok.

I confirmed all the slave address(0~255).

but only i could read two slave address for EEPROM(0xA0,0xA1).

did you have been confirmed with other peripherals for I2C?

I think that need more work for bmi160 i2c(i2c configuration,etc)

Does not it?

thank you.

0 Likes
Anonymous
Not applicable

You mean only 0xa0 and 0xa1 got ACK from slave device, right?

In this case, BMI160 doesn't connect with 20732 properly including power.

When I use three I2C sensors ADXL345, Si1145 and Si7013, they work fine.

I didn't do anything special for them.

0 Likes
Anonymous
Not applicable

that's right.

ok, i will more confirmation.

thanks.

0 Likes
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

Do you have a scope capture of the I2C lines (SCL and SDA) when your app is trying to access the BMI160 sensor?

0 Likes
Anonymous
Not applicable

the bmi160 scope signal is same when  EEPROM communicate I2C.

thank you.

0 Likes
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

Do you have a picture of it? I don't think it can be the same. When addressing the EEPROM, you should see a start, 0xA0 (or 0xA1), ack, (address or data), stop and when addressing BMI160, you should see 0x68 or 0xD0 instead of 0xA0 (0xA1).

0 Likes
Anonymous
Not applicable

i did not capture but i saw same signal.

if you need the screen,i will send capture the signal for you.

but now i can't because i have another thing.

maybe next week monday possible.

we use same line for i2c.we refer your document.

i heard from my hw team.

0 Likes
Anonymous
Not applicable

I have One more question.
Can i use another api for i2c?

I found  I2CM API.but now this api did not operate,too.

if can i use this api(I2CM) for bmi160 I2C,

Please tell me how to use(Initialization, using method, etc).

0 Likes
Anonymous
Not applicable

i2cm API should work.

i2cm_init();

i2cm_setSpeed(I2CM_SPEED_400KHZ);

i2cm_setTransactionSpeed();

i2cm_read();

You can refer below thread.

"I2cm_ ***" draw at asking for a description.

MiTo_1583836
Level 5
50 likes received 25 likes received 10 likes received
Level 5

Hi dmiya,

I did some research around the I2C API that you mentioned. I am not successful with pretty much the exact same steps that you mentioned. I have in my code the following:

(SDK-2.1.0)

> In the main function (executed once at boot):

  ....

  //Initialization of the i2cm interface.

    i2cm_init();

    i2cm_setSpeed(I2CM_SPEED_100KHZ);

    i2cm_setTransactionSpeed();

> In one second timer function (executed every second):

  UINT8 readData[2];

  UINT8 writeData=0xe3;

  ...

  //write 0xe3 @ device with address 0x40, and read 2 bytes of data.

  //0x80 is actually (0x40<<1), 0x40 is the address of the sensor I am trying to access.

  UINT8 status = i2cm_comboRead(&readData[0], 2, &writeData, 1, 0x80);

  switch(status)

  {

       case I2CM_SUCCESS:

            ble_trace0("processI2C_CMD> Success!\n");

            break;

       case I2CM_OP_FAILED:

            ble_trace0("processI2C_CMD> Failed!\n");

            break;

       case I2CM_BUSY:

            ble_trace0("processI2C_CMD> Busy!\n");

            break;

  }

I ran this piece of code on one device integrated with 20737S that has the sensor connected to it without success. The returned value is **I2CM_BUSY**.

I also ran the same code on the tag board#3 with the 20737 chip. My expectation here is that I should see at least the first write going out to 0x40 with nothing coming back. I don't see anything on the bus (I am connected to J9 connector tag board #3, pin 2(SCL) and 3(SDA)) and the function would return I2CM_BUSY, same as above.

Note: if I sniff the traffic on the I2C bus during the download of an application I do see the access to EEPROM with address A0 and A1 during 5 seconds, so my I2C measurement setup is correct.

0 Likes