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.

Tiva tm4c1294 I2C Read 1 Word

I am trying out the TM4C1294 Connected LaunchPad I2C library, whose functions are all included in driverlib/i2c.h.

Now I got some problems with reading 1 Word data from an I2C slave device I have in my hand. My read function looks like the follow:

// --------------------------To Write before read-----------------------

I2CMasterSlaveAddrSet (I2C0_BASE, 0x10, false); //set slave address and initiate with write

I2CMasterDataPut (I2C0_BASE, 0x88); //Put 0x88 in the FIFO register

I2CMasterControl (I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START); //Send

while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction

//--------------------------To read a Word by making it into 2 Bytes-----------------------------------------------

SysCtlDelay(g_ui32SysClock / 1000 / 3); //Delay a little bit

I2CMasterSlaveAddrSet (I2C0_BASE, 0x10, true); //set slave address to 0x10 and read

I2CMasterControl (I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); //Read the 1st Byte

while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction

B1 = (uint8_t)(I2CMasterDataGet (I2C0_BASE)); //Read from FIFO

I2CMasterControl (I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); //Read the 2nd Byte

while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction

B2 = (uint8_t)(I2CMasterDataGet (I2C0_BASE)); //Read from FIFO

//-------------------------------------------------------------------------------------------------------------------------------

Well, I tried to step these through in CCS, however, for some reason, I always see the same value in both B1 and B2(shown in the following picture), which should not be the case

Could anyone give me a clue of what is going wrong over here?

I know that I2CMasterDataGet() returns a uint32_t which is an unsigned integer, but for I2C, each sending or receiving should be limited to 1 Byte, and that is also the reason why I format the return value into a uint8_t here. Any reason why I2CMasterDataGet() returns 4 Byte integer instead of 1 Byte character, or am I not supposed to transform it into uint8_t at all?