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.

LAUNCHXL-CC2640R2: How to interface ADS1115 with CC2640R2 Launch pad

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: ADS1115

 Hai.... I am new to TI CC2640R2 controller. I have a very little knowledge on embedded c. I need to know how to interface ADS1115 ADC with CC2640R2 Launchpad usning I2C. If anyone have a sample example. Please share.

    txBuffer[0] = 0x01; //Pointer address 0x01 = config register
    txBuffer[1] = 0xC2; // CNF[15:8] 1100 0010
    txBuffer[2] = 0x83; //CNF[7:0] 1000 0011

    i2cTransaction.slaveAddress = ADS1115_ADDR;
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 3;
    i2cTransaction.readBuf = NULL;
    i2cTransaction.readCount = 0;

     if (!I2C_transfer(i2c, &i2cTransaction)) {
     /* Could not establish configuration */
     Display_printf(display, 0, 0, "Error. Configuration Transaction failed \n");
     // while(1);
     }
     else
         Display_printf(display, 0, 0, "Configuration Transaction successful \n");

     txBuffer[0] = 0x00; //Pointer address 0x00 = Conv register

     i2cTransaction.slaveAddress = ADS1115_ADDR;
     i2cTransaction.writeBuf = txBuffer;
     i2cTransaction.writeCount = 1;
     i2cTransaction.readBuf = NULL;
     i2cTransaction.readCount = 0;
     if (!I2C_transfer(i2c, &i2cTransaction)) {
          /* Could not establish conversion */
     Display_printf(display, 0, 0, "Error. Conversion Transaction failed \n");
     // while(1);
     }
     else {
            Display_printf(display, 0, 0, "Conversion Transaction successful \n");

            i2cTransaction.slaveAddress = ADS1115_ADDR;
            i2cTransaction.writeBuf = NULL;
            i2cTransaction.writeCount = 0;
            i2cTransaction.readBuf = rxBuffer;
            i2cTransaction.readCount = 2;

            if (I2C_transfer(i2c, &i2cTransaction)) {
                Read = (rxBuffer[0]<<8 | rxBuffer[1]);
                Voltage = (Read * voltageConv);
                Display_printf(display, 0, 0, "answer: %u: %u (V)", Read, Voltage);
            }
            else {
                        Display_printf(display, 0, 0, "I2C Bus fault.");
            }

When i run this code, it shows, 

  • Error. Configuration Transaction failed and
  • "Error. conversion Transaction failed