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.

TMS320F280049C: I2C clarification requied

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Dear all,

I have been recently working on i2c and have few doubts which i have tried my best to solve yet I'm not able to. So kindly help me in this:

1)From the example programs form ti i am seeing that after finishing all configuration and putting the data , we are calling start condition function and stop condition function is called. ist this the correct way....

I2C_putData(I2CA_BASE, 1);

//Send start as master transmitter
I2C_setConfig(I2CA_BASE, I2C_MASTER_SEND_MODE);
I2C_sendStartCondition(I2CA_BASE);
I2C_sendStopCondition(I2CA_BASE);

2) please read the following code snippet from ti example from  C:\ti\c2000\C2000Ware_3_04_00_00\driverlib\f28004x\examples\i2c\i2c_ex2_eeprom.c

void initI2C()
{
//
// Must put I2C into reset before configuring it
//
I2C_disableModule(I2CA_BASE);

//
// I2C configuration. Use a 400kHz I2CCLK with a 33% duty cycle.
//
I2C_initMaster(I2CA_BASE, DEVICE_SYSCLK_FREQ, 400000, I2C_DUTYCYCLE_33);
I2C_setBitCount(I2CA_BASE, I2C_BITCOUNT_8);
I2C_setSlaveAddress(I2CA_BASE, SLAVE_ADDRESS);
I2C_setEmulationMode(I2CA_BASE, I2C_EMULATION_FREE_RUN);

//
// Enable stop condition and register-access-ready interrupts
//
I2C_enableInterrupt(I2CA_BASE, I2C_INT_STOP_CONDITION | 
I2C_INT_REG_ACCESS_RDY);

//
// FIFO configuration

I2C_enableFIFO(I2CA_BASE);
 I2C_clearInterruptStatus(I2CA_BASE, I2C_INT_RXFF | I2C_INT_TXFF);

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

Here we are not setting  FIFO interrupt level or either we are having a FIFO isr in the main code. we are here just enabling the FIFO . how does that work ? Kindly explain . also please try to give a program flow. 

when i tried to comment out FIFO enable function , data was not transmitting. i have enabled tx ready interrupt and deal the whole thing without using FIFO. But then all I see is busy bit always set to 1 . How to use i2c without FIFO?

When i use the configuration of i2c same to example everything works but i just want to know what's happening....

Thanks and regards,

Stevin Martin

  • Hi,

    1) In non-repeat mode, you can execute I2C_sendStartCondition and I2C_sendStopCondition back to back because in this mode, I2C state machine doesn't generate STOP condition until number of bytes in I2CCNT register is transmitted / received.

    2) Couple of things here. If you are using I2C to interface with EEPROM I would encourage you to use below examples instead.

    i2c_ex4_eeprom_polling    : Different EEPROM read / write operation are performed without using I2C interrupts

    i2c_ex6_eeprom_interrupt : Different EEPROM read / write operation are performed with using I2C interrupts

    Also, why you don't want to use FIFO. 

    Regards,

    Manoj

  • Hi Manoj,

    Its not i don't want to use fifo. Here am trying to understand how everything works . My understanding to use FIFO was to enable it, set the buffer level, set the interrupt isr ..but here u see in the example we are not doing any of this , we are just enabling fifo. i am looking to clear that specific doubt first.

    Thanks and regards,

    Stevin Martin

  • Hi sir, 

    When does tx fifo interrupt in i2c isr gets trigger when trigger level set to I2C_FIFO_TXEMPTY . is it when a data change occur in the buffer?

    Thanks and regards,

    Stevin Martin

  • Steve,

    TX FIFO interrupt gets triggered when TX FIFO contents (TXFFST) is less than (or) equal to trigger level (TXFFIL).

    Regards,

    Manoj