4 Replies Latest reply on Oct 3, 2014 11:08 AM by MichaelF_56 Branched to a new discussion.

    Issue with i2cm.h - I2C communication

    MiTo_1583836

      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.