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.

EK-TM4C123GXL: I2C ReadWrite with multiData.

Part Number: EK-TM4C123GXL

Hi Guys,

I am using EK-TM4C123GXL to program an amplifier, for that I need to send a buffer Via I2C to a slave device mounted on the bus and readback a buffer from such slave also.

Basically I need a function to take a params like

 TI_WriteRead(  unsigned char slave_addr,
                                    int num_write_bytes,
                                    const unsigned char write_data[],
                                    int num_read_bytes,
                                    unsigned char read_data[] )

Is there please some ready API for ReadWrite via I2C with EK-TM4C123GXL  ?

Cheers,

Maw

  • Hello Maw,

    There isn't an API for what you are exactly describing provided within TivaWare. You would need to create an API like that using existing APIs such as:

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);
    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_RECEIVE);

    If you are transferring multiple bytes, there are also options for send and receive with BURST mode. These are all documented in the i2c.h file within the TIvaWare driverlib folder.

    Lastly you may want to reference our peripheral example folder found at: [Install Path]\TivaWare_C_Series-2.1.4.178\examples\peripherals\i2c