Issue with i2cm.h - I2C communication

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

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

I am continuing the discussion started here: Re: how can i use to i2c between bmi160 sensor and BCM20732?  with fresh new post.

I tried the I2C API defined in i2cm.h with no success.  I am using SDK 2.1.0 in the current example. I put a quick recap of the source code that I wrote to test the API.

> 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.

Please comment, Thanks (my current back up plan is to use the API defined in cfa.h)

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
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Unfortunately, the apps team is buried and may not be able to get to this one for another week or so.  In the meantime, the the current work around is to use the API in cfa.h.

Thanks for your patience.

View solution in original post

4 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I will ask one of the developers to respond.

0 Likes

Thanks, everything I have done can be reproduce on the tag board #3.

0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Unfortunately, the apps team is buried and may not be able to get to this one for another week or so.  In the meantime, the the current work around is to use the API in cfa.h.

Thanks for your patience.

Ok no problem , the cfa.h interface is working well for now.