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 question about NACK and reset

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I am using I2c on core 1 which are GPIO 104 and GPIO 105.

If I get a Nack from slave my clock goes low. 

1)Is there a register to look for Nack?

2) Is there a way I can reset my I2C module once I see this Nack register and how can it be donr to restart the i2c communication?

Thanks,

  • So I figured out if I receive nack from slave my dual core master i2c will have I2caRegs.I2CSTR.bit.NACK = 1;

    So now I reset i2c module by I2caRegs.I2CMDR.bit.IRS = 0000; and then set again the same registers as follows:
    I2caRegs.I2CMDR.bit.IRS = 1; // Take I2C out of reset
    I2caRegs.I2CPSC.all = 16; // Prescaler - need 7-12 Mhz on module clk
    I2caRegs.I2CCLKL = 482; // NOTE: must be non zero
    I2caRegs.I2CCLKH = 482; // NOTE: must be non zero
    I2caRegs.I2CIER.all = 0x2C;
    I2caRegs.I2CFFTX.all = 0x6000;
    I2caRegs.I2CFFRX.all = 0x6000;

    Whenever I do reset my i2c module then my clock frequency reduces from 100 khz to 6 khz. Why is that happening? When I first compile and execute the code the same clock registers make the clock running at 100 Khz but after reset or reset(in CCS)  it goes low to 6 Khz.

    Thanks

  • 1)

    After compiling with same clock registers as mentioned before i2c runs at 100 Khz

    2) After i2c module is reset via IRS register or reset in CCS 

    results in clock frequency at 6 khz

  • Hi Sagar,

    You cannot write to some of those register bits (such as I2CPSC) while the I2C module is out of reset (IRS = 1). You should take the I2C out of reset after I2CPSC, I2CCLKL, I2CCLKH, & I2CIER have all been initialized in your code, similar to what's in the i2c_eeprom example within c2000ware.

    Hopefully that fixes your issue!

    Best,
    Kevin