Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: TCAL9539
i have I2c code in 10ms ISR and after 25 count i have 250ms loop where i read ADC data.
I have changed code in ADC read data fucntion in 250ms loop and after that i got I2C FIFO timeout that is in 10ms loop.
the below code is I2C read data code:
uint8_t TCAL9539_ReadRegister(uint32_t base, uint8_t slaveAddress, uint8_t reg, uint8_t *I2Cstatus)
{
if(I2C_Error(base))
{
*I2Cstatus = I2CMCUError;
return 0;
}
uint8_t data,i;
uint8_t tempI2Cdata[2]={0};
uint8_t Attempt= 0;
/* while(I2CisBusBusy(base) == 1)
{
Attempt++;
DEVICE_DELAY_US(100);
if(Attempt >= 5)
{
*I2Cstatus=I2CBusyTimout;
//return 0;
}
}*/
Attempt= 0;
while(I2CgetStopConditionStatus(base) == 1)
{
Attempt++;
DEVICE_DELAY_US(200);
if(Attempt >= 5)
{
*I2Cstatus=I2CStopTimout;
return 0;
}
}
I2CenableFIFO(base);
I2CsetConfig(base,I2C_CONTROLLER_SEND_MODE);
I2CsetSlaveAddress(base,slaveAddress);
I2CsetDataCount(base,1);
I2CputData(base,reg);
I2CsendStartCondition(base);
Attempt= 0;
while(I2CgetTxFIFOStatus(base))
{
Attempt++;
DEVICE_DELAY_US(200);
if(Attempt >= 5)
{
*I2Cstatus=I2CTxFifoTimout;
return 0;
}
}
I2CsetConfig(base, I2C_CONTROLLER_RECEIVE_MODE);
I2CsetDataCount(base,2);
I2CsendStartCondition(base);
for(i=0;i<2;i++)
{
tempI2Cdata[i] = I2C_getData(base);
}
Attempt= 0;
while(I2CgetRxFIFOStatus(base) != I2C_FIFO_RX2)
{
Attempt++;
DEVICE_DELAY_US(200);
if(Attempt >= 5)
{
*I2Cstatus =I2CRxFifoTimout;
return 0;
}
}
I2CsendStopCondition(base);
Attempt= 0;
while(I2CgetStopConditionStatus(base) == 0)
{
Attempt++;
DEVICE_DELAY_US(200);
if(Attempt >= 5)
{
*I2Cstatus =I2CStopTimout;
return 0;
}
}
data = (tempI2Cdata[0] & 0xFF) + ((tempI2Cdata[1] & 0xFF) << 8);
*I2Cstatus =I2CSuccess;
return data;// Send stop condition to end the write phase
}
The below code is ADC read data fucntion:
Before change:
float GetNT1000TempValue(float32_t SensorVoltage);
ChargerData.AMB = GetNT1000TempValueAMB(AMB,10000.0f,100000.0f);
After change:
float GetNT1000TempValue(float32_t SensorVoltage,float RPULL,float R01,float gain,float pullupvolt);
ChargerData.AMB = GetNT1000TempValue(AMB,10000.0f,100000.0f,1.0f,3300.0f);
The above code is the only change where i have added 4 float variables and that has caused I2CRxFifoTimout in the I2C status and before change we got I2C status as I2CSuccess in the 10ms loop.
we have stack size of 0x400 out of which we have used only 0x200 which we got to know form the map file.
We need to know why it has happened and the reason for it as well. Thank you.

