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.

Piccolo I2C Transmit Issue onTMS320F28609

Other Parts Discussed in Thread: TMS320F28069

When attempting to use the I2C in master transmit mode on the TMS320F28069, I have found I am unable to transmit more than 2 data bytes although I am attempting to transmit many more (250 bytes).  My scope is indicating that the slave is ack'ing the address byte and the two data bytes, but then the I2C transmission stops.  See my code below.  When i pause the code in the debugger, I am stuck in the following while loop:

while ( (I2caRegs.I2CSTR.bit.XRDY == 0 ) && (I2caRegs.I2CSTR.bit.ARDY == 0 )){};

I am not using the FIFO and simply trying to poll the (I2caRegs.I2CSTR.bit.XRDY bit.

Any ideas on what could be going on?

Thank you.

void Init_Master(void)
{
    EALLOW;

   GpioCtrlRegs.GPBPUD.bit.GPIO32 = 0;    // Enable pull-up for GPIO32 (SDAA)
   GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0;    // Enable 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;

   I2caRegs.I2CMDR.all = 0x0000;    // I2C in reset  

   I2caRegs.I2CPSC.all = 4;            // Prescaler - need 7-12 Mhz on module clk
   I2caRegs.I2CCLKL = 40;            // NOTE: must be non zero
   I2caRegs.I2CCLKH = 40;            // NOTE: must be non zero
   I2caRegs.I2CIER.all = 0x00;        // No interrupts enabled

   I2caRegs.I2CMDR.all = 0x0020;    // Take I2C out of reset
                                       // Stop I2C when suspended

   
   I2caRegs.I2COAR = 0x0004;        // Own Address
   
   return;
}

void Write_Master(uint8_t address, uint8_t * write_data, uint8_t bytes)
{
    
   int16_t i;

    /* Check for Bus Busy */
   while ((I2caRegs.I2CSTR.bit.BB == 1 ));
 
   /* Disable I2C during configuration */
   I2caRegs.I2CMDR.all = 0;
 
   /* Set the I2C controller to write len bytes */
   I2caRegs.I2CCNT = bytes;
   I2caRegs.I2CSAR = 0x08;

   I2caRegs.I2CMDR.bit.IRS = 1;
   I2caRegs.I2CMDR.bit.TRX = 1;
   I2caRegs.I2CMDR.bit.STP = 1;
   I2caRegs.I2CMDR.bit.MST = 1;
   I2caRegs.I2CMDR.bit.FREE = 1;
   I2caRegs.I2CMDR.bit.STT = 1;

   /* Transmit data */
   for (i = 0; i < bytes-4; i++)
   {
     // Wait for "XRDY" flag to transmit data or "ARDY" if we get NACKed
     while ( (I2caRegs.I2CSTR.bit.XRDY == 0 ) && (I2caRegs.I2CSTR.bit.ARDY == 0 )){};
     I2caRegs.I2CDXR = ICC_TEST_PATTERN;

     // If a NACK occurred then SCL is held low and STP bit cleared
     if ( I2caRegs.I2CSTR.bit.NACK == 1 )
     {
            I2caRegs.I2CMDR.all = 0;        // reset I2C so SCL isn't held low
            iic_comm_error = NO_ACK_ON_WRITE_ERROR;
            I2caRegs.I2CMDR.all = 0x0020;
            return;
     }

   }
   return;
}