Hello. We are using the Hercules RM48L952 board with HalCoGen generated driver. When we ran off of the I2C example with interrupts enabled for loop back test of I2C. After 2 loops of sending, i2CSendByte generated by HalCoGen gets stuck in the endless loop in this HalCoGen function in i2c.c. Is there another step missing so that the while is not stuck in this infinite loop? What does it mean when it is in this infinite loop? Thank you
(HalCoGen function in i2c.c)
void i2cSendByte(i2cBASE_t *i2c, uint8 byte)
{
/* USER CODE BEGIN (15) */
/* USER CODE END */
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
while ((i2c->STR & (uint32)I2C_TX_INT) == 0U)
{
} /* Wait */
i2c->DXR = (uint32)byte;
/* USER CODE BEGIN (16) */
/* USER CODE END */
}
Our test code based on TI sample code below
/** @fn void I2CInterruptDriverTest(void)
*
* This function tests I2C send and receive via Interrupt (loopback)
*/
void I2CInterruptDriverTest(void)
{
/* USER CODE BEGIN (3) */
uint32 buf_size = bsize;
uint8 *ti_buff = &TX_PACK[0];
uint8 *ri_buff = &RX_PACK[0];
uint8 i2cTest = PASS;
/* set i2c own address */
i2cSetOwnAdd(i2cREG1,own_add);
/* enable internal loopback */
i2cEnableLoopback(i2cREG1);
/* Initiate Receive data length & destination ptr */
i2cReceive(i2cREG1, 16, ri_buff);
/* Initiate Start condition for Transmission */
i2cSetStart(i2cREG1);
/* send data packets */
while(buf_size--)
{
2cSendByte(i2cREG1,*ti_buff++);
}
...
/* Clear Stop Condition detect flag */
i2cClearSCD(i2cREG1);
/* Disable RX ready Interrupt */
i2cDisableNotification(i2cREG1, I2C_RX_INT);
/* USER CODE END */
}