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.

TM4C123GH6PM: Tiva Dual Slave

Part Number: TM4C123GH6PM

Trying to find an example of the dual slave I2C capability.  I'm wondering if this will allow me to use I2C0 with two slave addresses.  If so how do you set it up and how does the interrupt differentiate between the incoming addresses.  The documentation I've found just mentions it in passing and I haven't been able to find more.

	// Configure and turn on the I2C0 slave interrupt.  We are only interrupting when the slave device receives data.
	I2CSlaveIntEnableEx(I2C0_BASE, I2C_SLAVE_INT_DATA);

	// Enable the I2C0 slave module.
	I2CSlaveEnable(I2C0_BASE);

	// Set the slave address to SLAVE_ADDRESS.
	I2CSlaveInit(I2C0_BASE, EEPROM_SLAVE_ADDRESS);
	
	
	
void irq_I2C0SlaveIntHandler(void)
{

    uiStatus = I2CSlaveStatus(I2C0_BASE);


    // Clear the I2C0 interrupt flag.
    I2CSlaveIntClear(I2C0_BASE);

    //////////////////////////////////////////////////
    //DSP Master has requested data
    //
    if(uiStatus & I2C_SLAVE_ACT_TREQ)
    {
        I2CSlaveDataPut(I2C0_BASE, (uint8_t)oData);
    }
    //
    //////////////////////////////////////////////////

    //////////////////////////////////////////////////
    //Master has sent data
    //
    if(uiStatus &I2C_SLAVE_ACT_RREQ)
    {
        // master is pushing data
        uiData = I2CSlaveDataGet(I2C0_BASE);
        ....
        }

This is roughly my current setup.  Would like to recognize a second address with it's own operation but not sure how if it is indeed possible.  I can't seem to find anything besides a one line reference to I2CSOAR2

  • Here is the description from the datasheet:

    You use the TivaWare function I2CSlaveAddressSet() to setup the second address. The function I2CSlaveInit will enable the I2C module and setup the first slave address. (Alternatively you can use I2CSlaveAddressSet() to setup both addresses.)

        I2CSlaveInit(I2C0_BASE, SLAVE_ADDRESS0);
        I2CSlaveAddressSet(I2C0_BASE, 1, SLAVE_ADDRESS1);
    

    In the interrupt service routine call I2CSlaveStatus() and check if the I2C_SLAVE_ACT_OWN2SEL bit (bit 3) is set. If it is, the second address caused the interrupt.

  • Thank you.  I missed that.