This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF-LAUNCHXL: CC3200SF I2C

Part Number: CC3220SF-LAUNCHXL

Dear Sir,

I am currently work on CC3200SF I2C to other board, just start on this, I have question in below

1. Can I watch i2c bus by connecting to J16 I2c SDA and J15 I2c SCL to my DigView, I just did but no Trigger and two lines always 1

2. we plan use P02 as Data and P01 as Clk It 's OK for taking this two pin as I2C bus to our other board ?

3. Can you point me to a example to work on I2C

Thanks in advance

Jason Liu

  • Jason,

    Yes, you should be able to probe those lines with a oscilloscope or logic anaylzer and see any data that you are sending.

    Inside our SDK, we have a example called i2ctmp006. You can open this and get a good idea on how to configure the I2C peripheral and write to a device.

    www.ti.com/.../SIMPLELINK-CC3220-SDK

    Regards,
    Vince Rodriguez
  • Vince Rodriguez,
    Thank you very much!
    Jason Liu
  • Dear Sir.

    Thank you very much about i2ctmp006 example you point to me. It worked as expected without any problem.

    I have questions about that code
    1. Why I can't change slaveAddress : Board_TMP_ADDR; if I change something else other than Board_TMP_ADDR then status return false when do I2C_transfer();
    2. When I removed two jumper which J2 and J3 about SDA and SCL then dead lock in I2C_transfer();
    3. How to setup the I2C_open(Board_I2C0, &i2cParams); specially Board-I2C0

    Below is test code.

    Thanks in advance

    Jason Liu

    void *mainThread(void *arg0)
    {
    I2C_Handle i2c;
    I2C_Params i2cParams;
    I2C_Transaction i2cTransaction;
    bool status;

    unsigned char writeBuffer[3];
    writeBuffer[0] = 0x55;
    writeBuffer[1] = 0x55;
    writeBuffer[2] = 0x55;

    /* Call driver init functions */
    Display_init();
    GPIO_init();
    I2C_init();

    /* Configure the LED pin */
    GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

    /* Open the HOST display for output */
    display = Display_open(Display_Type_UART, NULL);
    if (display == NULL) {
    while (1);
    }

    /* Turn on user LED */
    GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
    Display_printf(display, 0, 0, "Starting the i2ctmp006 example\n");

    /* Create I2C for usage */
    I2C_Params_init(&i2cParams);
    i2cParams.bitRate = I2C_400kHz;
    i2c = I2C_open(Board_I2C0, &i2cParams);
    if (i2c == NULL) {
    Display_printf(display, 0, 0, "Error Initializing I2C\n");
    while (1);
    }
    else {
    Display_printf(display, 0, 0, "I2C Initialized!\n");
    }

    /* Point to the T ambient register and read its 2 bytes */

    i2cTransaction.slaveAddress = Board_TMP_ADDR;
    i2cTransaction.writeBuf = writeBuffer;
    i2cTransaction.writeCount = 3;
    i2cTransaction.readBuf = NULL;
    i2cTransaction.readCount = 0;

    status = I2C_transfer(i2c, &i2cTransaction);
    if (!status)
    {
    Display_printf(display, 0, 0, "I2C_transfe error!\n");
    }
    else
    {
    Display_printf(display, 0, 0, "status true\n");
    }

    sleep(1);

    /* Deinitialized I2C */
    I2C_close(i2c);
    Display_printf(display, 0, 0, "I2C closed!\n");

    return (0);
    }

  • Jason,

    1. Why I can't change slaveAddress : Board_TMP_ADDR; if I change something else other than Board_TMP_ADDR then status return false when do I2C_transfer();

    If you are using the on board temp sensor, then address is set by default by hardware. If you change this you wont be able to communicate to the device

    2. When I removed two jumper which J2 and J3 about SDA and SCL then dead lock in I2C_transfer();
    This is the connection for I2C. You need these connected for proper functionality.

    3. How to setup the I2C_open(Board_I2C0, &i2cParams); specially Board-I2C0
    The way you are describing is correct. Be sure this is configured in your board files as well.

    Regards,
    VR
  • VR,

    Thank you for your quick answer , One more question , How to disable on board temp sensor or not using on board temp sensor , since I like to use I2C to talk other board ?
  • Jason,

    You can remove the I2C jumpers; these connect the on board sensors to the I2C lines that are routed out of the Boosterpack Connectors. They would be bottom left jumpers, J15 and J16.

    Regards,

    VR

  • VR,

    I removed J15 and J16. my test code dead lock with status = I2C_transfer(i2c, &i2cTransaction);

    even stay with i2cTransaction.slaveAddress = Board_TMP_ADDR; or set to 0x50

    So Did I miss something here ?

    Thanks in advance

    Jason Liu
  • Jason,

    Have you connected the new sensor to your I2C pins? If you have not, then the device is trying to communicate to the temp sensor which is no longer connected, and it hangs.

    Regards,
    VR