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.

TMS320F28075: TMS320F28075 I2C repeated start initiation

Part Number: TMS320F28075
Other Parts Discussed in Thread: TCA9539, CONTROLSUITE

I am currently using an I2C interface to communicate with the TCA9539 GPIO expander. I have gotten read operations to the chip to work, which require a repeated start condition as listed below. I've noticed, though, that the while loop that waits for ARDY to clear takes a substantial amount of time to complete. Is there a way to setup the I2C registers to autonomously perform the repeated start condition (as I demonstrated) without having to wait for ARDY to set (or using interrupts)?

A follow-up question to the first is that using the code below, I can see on my oscilloscope that repeated start is initiated and two bytes are transmitted back. However, no bytes are read from the RX FIFO when accessing I2CDRR. If I change the code below and set RM for repeat mode, I can see the data received by accessing I2CDRR (but only one byte is received because the number of transmissions is no longer dependent on I2CCNT, as expected).


  if(i2c_regs->I2CMDR.bit.STP || i2c_regs->I2CSTR.bit.BB) {
    return;
  }
  // set the I2C address
  i2c_regs->I2CSAR.bit.SAR = 0x77;
  i2c_regs->I2CCNT = 1;
  // PORT0 inputs are at address 0
  i2c_regs->I2CDXR.bit.DATA = 0;

  i2c_regs->I2CMDR.bit.IRS = 1;
  i2c_regs->I2CMDR.bit.MST = 1;
  i2c_regs->I2CMDR.bit.TRX = 1;
  i2c_regs->I2CMDR.bit.STP = 0;
  i2c_regs->I2CMDR.bit.STT = 1;

  // wait for I2C register settings to be used
  while(i2c_regs->I2CSTR.bit.ARDY == 0);

  // set number of bytes to expect
  i2c_regs->I2CCNT = 1;

  // send start as master transmitter
  i2c_regs->I2CMDR.bit.IRS = 1;
  i2c_regs->I2CMDR.bit.MST = 1;
  i2c_regs->I2CMDR.bit.TRX = 0;
  i2c_regs->I2CMDR.bit.STP = 1;
  i2c_regs->I2CMDR.bit.STT = 1;

  • Benjamin,

    i2c_eeprom example project in controlSuite uses FIFO and does what you intend to do. Did you already check this example?

    Regards,
    Manoj
  • Yes, I looked at the example already, but it uses interrupts to handle the restart condition. My question is if it was possible to do this without using interrupts. After spending more time reading the documentation and experimenting though, I'm pretty sure the answer is no. At this point, I am more concerned with the second part of my question.

    Update: My mistake was that I was setting RXFFST = 1 instead of RXFFRST = 1 to enable the receive FIFO.