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.

CC1350: Interfacing CC1350 with 2 separate I2C devices

Genius 9880 points
Part Number: CC1350

Hi,

Customer have an issue using the IC in a customer board, please see details below.

"Hello, I am trying to interface a cc1350 with 2 separate I2C devices. They are currently not on the same pcb bus meaning that they are connected to 2 sets of pins on the 1350 (ex dev1 is on 1 and 2, and dev2 is on 8, 9). Is it possible to communicate with both using a cc1350? I have tried ensuring that one interface is closed before opening the other but the program hangs when trying to setup the second interface for the first time."

Thank you in advance.

Regards,
Maynard

  • As long as you setup the driver before and close the driver after using it for one given set of pins this should be possible. 

    How have you implemented the setup and switch of physical pins between the two IC interfaces? 

    but the program hangs when trying to setup the second interface for the first time

    Also, debug and find out where in the code the programs hangs. 

  • Hi TER,

    Below is the response from the customer.


    "The first driver is closed before opening the second. When i used the debugger to see where the problem was, it seems like it is waiting on an hwi"

    Regards,
    Maynard

  • At which code line is this? Also, does the second I2C interface work if the first interface is never used? 

  • Hi TER,

    Please see below response from customer.

    "I do not know the exact line, when it hangs and I pause execution this is what it shows me

    "

    Regards,
    Maynard

  • - Does both I2C interfaces work as wanted if only one interface is used? (with no switch between interfaces)

    - Customer should include the I2C driver files into the project and single step trough the code to see which line it fails. 

  • Hi TER,

    Just received response from customer, please see details below.

    "It appears to be a problem with the second interface. It opens the I2C interface but upon transaction it hangs on this line when i step through:

    "

    Regards,
    Maynard

  • How is the interfaces setup? The following code shows how a swap between two interfaces using two different pin set can be done:

    void *mainThread(void *arg0)
    {
    uint8_t txBuffer[2];
    uint8_t rxBuffer[4];
    I2C_Handle i2c1, i2c2;
    I2C_Params i2cParams1, i2cParams2;
    I2CCC26XX_I2CPinCfg pinCfg;
    I2C_Transaction i2cTransaction;
    
    I2C_init();
    
    I2C_Params_init(&i2cParams1);
    i2cParams1.bitRate = I2C_100kHz;
    
    i2c1 = I2C_open(Board_I2C_TMP, &i2cParams1);
    if (i2c1 == NULL)
    {
    while (1);
    }
    
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.readBuf = rxBuffer;
    
    // Write 0x01 to register 0x0F (start conversion)
    i2cTransaction.slaveAddress = 0x41;
    txBuffer[0] = 0x0F;
    txBuffer[1] = 0x01;
    i2cTransaction.writeCount = 2;
    i2cTransaction.readCount = 0;
    I2C_transfer(i2c1, &i2cTransaction);
    
    I2C_close(i2c1);
    
    
    
    I2C_Params_init(&i2cParams2);
    pinCfg.pinSDA = CC1310_LAUNCHXL_DIO12;
    pinCfg.pinSCL = CC1310_LAUNCHXL_DIO1;
    i2cParams2.custom = &pinCfg;
    
    
    i2c2 = I2C_open(Board_I2C_TMP, &i2cParams2);
    if (i2c2 == NULL)
    {
    while (1);
    }
    
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.readBuf = rxBuffer;
    
    // Write 0x01 to register 0x0F (start conversion)
    i2cTransaction.slaveAddress = 0x41;
    txBuffer[0] = 0x0F;
    txBuffer[1] = 0x01;
    i2cTransaction.writeCount = 2;
    i2cTransaction.readCount = 0;
    I2C_transfer(i2c2, &i2cTransaction);
    
    I2C_close(i2c2);
    
    return (NULL);
    }

    Also see https://dev.ti.com/tirex/explore/content/simplelink_cc13x0_sdk_4_20_01_03/docs/tidrivers/doxygen/html/struct_i2_c_c_c26_x_x___i2_c_pin_cfg.html#details

    Also, is it any activity on the I2C bus before the code starts pending on the semaphore?