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.

I2C FIFO bus stuck

Other Parts Discussed in Thread: TMDSDOCK2808

I am trying to communicate with a PCA9535C I2C chip on the F2808 (I am using the TMDSDOCK2808 kit).

I am attempting to do this in FIFO since I can't use interrupts and whenever I attempt to do a second write to the PCA9535C, the bus busy bit and STP bit are both set. I'm quite new to the I2C bus but I have an understanding of how it works. I've got pull-up resistors of 4.7K for SDAA/SCLA connected to the 3.3V pins of the TMDSDOCK kit. When I look at the scope, SDAA goes back to high as it should, but SCLA gets stuck low.

I took the i2c eeprom example and generated the relevant code:

Setup:

void InitI2CGpio()
{

EALLOW;

GpioCtrlRegs.GPBMUX1.all = 0;
GpioCtrlRegs.GPAMUX2.all = 0;
GpioCtrlRegs.GPBPUD.bit.GPIO32 = 1; // Disable internal pull-up for GPIO32 (SDAA)
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 1; // Disable internal pull-up for GPIO33 (SCLA)

GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 3; // Asynch input GPIO32 (SDAA)

GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 3; // Asynch input GPIO33 (SCLA)

GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 1; // Configure GPIO32 for SDAA operation

GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 1; // Configure GPIO33 for SCLA operation
EDIS;
}

void initialize_i2c (void)
{
  // Setup for 100 KHz SCL
  I2caRegs.I2CMDR.bit.IRS = 0; // Make sure that reset is on to configure clk
  I2caRegs.I2CPSC.all = 9; // Prescaler - need 7-12 Mhz on module clk
  I2caRegs.I2CCLKL = 60; // NOTE: must be non zero
  I2caRegs.I2CCLKH = 30; // NOTE: must be non zero
  I2caRegs.I2CIER.all = 0x0; // Disable all I2C interrupts
  I2caRegs.I2COAR = I2C_MASTER_ADDR;
  I2caRegs.I2CFFTX.bit.TXFFRST = 0;
  I2caRegs.I2CFFTX.all = 0x6060; // Enable FIFO mode and TXFIFO
  I2caRegs.I2CFFTX.bit.TXFFRST = 1;
  I2caRegs.I2CFFTX.bit.TXFFINTCLR = 1;
  I2caRegs.I2CFFRX.all = 0x0000; // Disable RXFIFO
}

Test part of the main function:

for (;;) {
  if (write_done == 0) {
    if (I2caRegs.I2CSTR.bit.BB == 0) { // Wait til the bus isn't busy, else stay in this state
      I2caRegs.I2CSAR = 0x20;
      I2caRegs.I2CCNT = 2; // 1 command byte, 1 byte write
      I2caRegs.I2CDXR = 0x6; // Command 6, port 0 config
      I2caRegs.I2CDXR = 0;
      I2caRegs.I2CMDR.all = 0x6E20;
      write_done++;
    }
  } else {
  if (write_done == 1) {
    DELAY_US(120);
    if (I2caRegs.I2CSTR.bit.BB == 0) { // Wait til the bus isn't busy, else stay in this state
      I2caRegs.I2CSAR = 0x20;
      I2caRegs.I2CCNT = 2; // 1 command byte, 1 byte write
      I2caRegs.I2CDXR = 0x2; // Command 2, port 0 write
      I2caRegs.I2CDXR = 0;
      I2caRegs.I2CMDR.all = 0x6E20;
      write_done++;
    }
  } else {
    break;
  }
}
}