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.

TMS320F28379D: I2C NACK from tms320f28379d

Part Number: TMS320F28379D

Hi guys,

I have used tms320f28379d and configured its I2CA and  I2C-B as Slaves. I have attached the configurations.I am supposed to receive 10 bytes from the Master. But during the transimmison , the TI controller sends a NACK after receiving certain bytes(sometimes 3 or 7, it is not repetitive) and the issue does not occur repeatedly but it is seen often.The same issue is not observed in I2CA. 

I have also attached Picoscope captures of the I2C-B communication where the NACK is observed.

Could someone help to debug the issue.Also, what are the possible situations , a NACK is sent by the TI controller?

void Init_I2CB_FIFO(void)
{
//
// Must put I2C into reset before configuring it
//
//I2C_disableModule(I2CB_BASE);
    I2C_disableModule(I2CB_BASE);
// I2C slave configuration
//
    I2C_setConfig(I2CB_BASE, I2C_SLAVE_RECEIVE_MODE | I2C_SLAVE_SEND_MODE);
    I2C_setDataCount(I2CB_BASE, 10);
    I2C_setBitCount(I2CB_BASE, I2C_BITCOUNT_8);
    I2C_setOwnSlaveAddress(I2CB_BASE, SLAVE_ADDRESS2);
    I2C_setEmulationMode(I2CB_BASE, I2C_EMULATION_FREE_RUN);
    I2C_enableFIFO(I2CB_BASE);
    I2C_clearInterruptStatus(
            I2CB_BASE, I2C_INT_RXFF | I2C_INT_TXFF | I2C_INT_STOP_CONDITION);

//
// Receive FIFO interrupt levels are set to generate an interrupt
// when the 16 byte RX fifo contains 10 or greater bytes of data.
//
    I2C_setFIFOInterruptLevel(I2CB_BASE, I2C_FIFO_TX6, I2C_FIFO_RX10);
    I2C_enableInterrupt(I2CB_BASE,
    I2C_INT_RXFF | I2C_INT_TXFF | I2C_INT_STOP_CONDITION);

//
// Configuration complete. Enable the module.
//
    I2C_enableModule(I2CB_BASE);
}

void Init_I2CA_FIFO(void)
{
//
// Must put I2C into reset before configuring it
//
    I2C_disableModule(I2CA_BASE);
// I2C slave configuration
//
    I2C_setConfig(I2CA_BASE, I2C_SLAVE_RECEIVE_MODE | I2C_SLAVE_SEND_MODE);
    I2C_setDataCount(I2CA_BASE, 10);
    I2C_setBitCount(I2CA_BASE, I2C_BITCOUNT_8);
    I2C_setOwnSlaveAddress(I2CA_BASE, SLAVE_ADDRESS1);
    I2C_setEmulationMode(I2CA_BASE, I2C_EMULATION_FREE_RUN);
    I2C_enableFIFO(I2CA_BASE);
    I2C_clearInterruptStatus(
            I2CA_BASE, I2C_INT_RXFF | I2C_INT_TXFF | I2C_INT_STOP_CONDITION);

//
// Receive FIFO interrupt levels are set to generate an interrupt
// when the 16 byte RX fifo contains 10 or greater bytes of data.
//
    I2C_setFIFOInterruptLevel(I2CA_BASE, I2C_FIFO_TX6, I2C_FIFO_RX10);
    I2C_enableInterrupt(I2CA_BASE,
    I2C_INT_RXFF | I2C_INT_TXFF | I2C_INT_STOP_CONDITION);

//    Configuration complete. Enable the module.

    I2C_enableModule(I2CA_BASE);

}

  • Hi, 

    Does this occur only with I2CB? Did you check if there is any difference in the configuration of I2CA and I2CB?

    Also, this line of code is confusing - Are you configuring it as slave receiver or slave transmitter? It can be either and cannot be both at the same time  

    I2C_setConfig(I2CA_BASE, I2C_SLAVE_RECEIVE_MODE | I2C_SLAVE_SEND_MODE);

    These are the conditions that lead to the generation of a NACK:

    1. No receiver is present on the bus with the transmitted address so there is no device to respond with an acknowledge.

    2. During the transfer, the receiver gets data or commands that it does not understand.

    3. During the transfer, the receiver cannot receive any more data bytes. A master-receiver must signal the end of the transfer to the slave transmitter.

    Best Regards

    Siddharth

  • Hi,

    This occurs only with I2C-B.

    There is no difference in the configuration of I2C A and I2CB.

    I would want the slave to receive 10 bytes data usually but also transmit 10 bytes under certain condition when the Master needs this data.

    So how can i best configure I2C as ?

  • Hi, 

    That's strange, if the configuration is same for both I2CA and I2CB, I would expect to see the same behavior on I2CA and I2CB. 

    Since it is not repeatable , it will be difficult to debug this. 

    You can switch the mode to either Slave transmitter or Slave receiver depending on the conditions in your code

    Best Regards

    Siddharth