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.

F28M36P63C2: I2C Slave Interrupt

Part Number: F28M36P63C2

Hi all,

I'm trying to implement a basic I2C slave who always replies the same data when the master tries to read a byte. 

The data is 0xbb.

When I try to read in the first time after reset the microcontroller, the data is received correctly, as expected. But, if I try to read again, the data received in the master is corrupted.

My master is already tested and works well with another device.

Here is my code for I2C ISR.

void isr_i2c_slave_offboard_isolated(void)
{
    if (I2CSlaveIntStatus(I2C_OFFBOARD_ISO_SLAVE_BASE, I2C_SLAVE_INT_DATA)) {

        g_ui32Status = I2CSlaveStatus(I2C_OFFBOARD_ISO_SLAVE_BASE);

        if (g_ui32Status & I2C_SLAVE_ACT_RREQ) {
            g_ui32DataRx = I2CSlaveDataGet(I2C_OFFBOARD_ISO_SLAVE_BASE);
        }

        if (g_ui32Status & I2C_SLAVE_ACT_TREQ) {
            I2CSlaveDataPut(I2C_OFFBOARD_ISO_SLAVE_BASE, 0xbb);
        }


    }

    I2CSlaveIntClear(I2C_OFFBOARD_ISO_SLAVE_BASE);
    I2CSlaveIntClearEx(I2C_OFFBOARD_ISO_SLAVE_BASE, I2C_SLAVE_INT_DATA);

}

I need to check something else in ISR?

Thanks!

  • Allef,

    Please confirm that you are using the M3 I2C.

    Is the execution never re-entering the I2C interrupt after the first time?
    Are the Start or Stop interrupts pending?

    Your ISR looks like it is doing everything it needs to. what other debug steps have you taken?

    -Mark
  • Hi Allef,

    I haven’t heard from you for a few days, so I’m assuming you were able to resolve your issue. If this isn’t the case, please reject this resolution or reply to this thread. If this thread locks, please make a new thread describing the current status of your issue.

    Thanks,
    Mark