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: Using I2C driver to communicate to different slaves and different registers on one slave

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: TMP117EVM, TMP117

I was wondering if there were any examples for using the I2C driver to communicate with:

  • multiple slaves on the same bus 
  • writing / reading to different registers on one slave in particular the TMP117EVM. 

I've read all the comments in the ISC.h file and its somewhat unclear. I understand to speak to different registers I need to tell the bus the registers address but there isn't any examples of it in the file and to me it seems like it isn't implemented in the driver, maybe I'm mistaken. 

  • This talks about writing to the register by "The user can write a register address to the pointer register to access a particular register on the TMP117. The value for the pointer register is the first byte transferred after the slave address byte"

    I'm mostly confused on how to execute this in the C code using the I2C.h file

    www.ti.com/.../snosd82a.pdf

  • After researching I found an example of how to write to a specific register on a slave and it is as follows:

    uint8_t rxBuffer[2];
    uint8_t txBuffer[2];

    WriteBuffer[0] = Specific_Register;
    WriteBuffer[1] = Byte;

    i2cTransaction2.slaveAddress = TMP117_address;
    i2cTransaction2.writeBuf = WriteBuffer;
    i2cTransaction2.writeCount = 1;
    i2cTransaction2.readBuf = ReadBuffer;
    i2cTransaction2.readCount = NULL;

    But when I apply this to my code and read that specific register it is not holding the value I sent to it.
  • Hi Christopher,

    Forgive the delay. We do not have any examples for multiple slaves but fortunately it's not difficult. You can create an I2C_Transaction object for each i2c slave device and when you want to send to a specific slave just use I2C_transfer(i2cHandle, "appropriate I2C_Transaction object").

    Check out our I2C APIs here and our i2ctmp example in the SDK for more details:
    dev.ti.com/.../

    Jesu
  • Thank you this solves the issue of sending to multiple slaves now my other question is how i would send to different registers in one slave.
    The slave i am using has a temp_reg, high_lim_reg, low_lim_reg, configure_reg, and tempoffset_reg.
    My problem now is writing data to each register in the slave so i can get the desired results when reading temperature.
  • Thank you this solves the issue of sending to multiple slaves now my other question is how i would send to different registers in one slave.
    The slave i am using has a temp_reg, high_lim_reg, low_lim_reg, configure_reg, and tempoffset_reg.
    My problem now is writing data to each register in the slave so i can get the desired results when reading temperature.
  • Hi Christopher,

    We have a great app note that will teach you more about I2C and how addressing and data works on the I2C bus (regarding your specific question refer to section 3.1 an 3.1 of the app note linked below).

    www.ti.com/.../slva704.pdf

    Your TMP117 sensor has a pointer register (datasheet section 7.5.2 linked below) that you use to access data registers for both read and write operations. The value stored in the pointer register is the first byte of data you send after the slave address. Chapter 7 will tell you everything you need to know regarding how to interact with the device.

    The datasheet for the TMP117 explains how to interact with the device. www.ti.com/.../tmp117.pdf

    Jesu