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.

Temperature sensor with I2C not working on TM4c129xnczad

Other Parts Discussed in Thread: TM4C129XNCZAD

Hello All,

I have interfaced I2C port 2 with Temperature sensor (Si7050/3/4/5-A20 device name) on TM4C129xnczad. I am using TI-RTOS I2C driver.

TO measure the temperature i am sending the command 0xE3 as per datasheet. The datasheet you can download through website just type the part number i mentioned.

The code which i am writing is mentioned below:

for I2C init:

I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_100kHz;

i2cParams.transfermode = I2C_MODE_BLOCKING;

i2c = I2C_open(0, &i2cParams);

txBuffer[0] = 0xE3; /* Command to measure temperature */
i2cTransaction.slaveAddress = 0x40;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 3;

if (I2C_transfer(i2c, &i2cTransaction))
{

temp = (rxBuffer[0] << 8) | (rxBuffer[1]);

}

What happens is sometimes it will work and sometimes it will not. So i tried to find out the reason why it is happening.

Later i identified is that whenever i am not getting data Arbitration lost happened i.e. I2C_MCS register set the ARBLST.

I don't understand why it is behaving in that manner.

As i mentioned sometimes it will work. This happens many times so not able to identify the exact reason for this.

Please help me out to solve this problem.

Thanks

Sanyam Agarwal