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.

I2C master read on TIVA TM4CDNCPDT

Other Parts Discussed in Thread: TM4C129DNCPDT

Hi all,

I got two problem on TIVA TM4C129DNCPDT when read from I2C.

The first one:

Read from slave by sent data 0 to slave address 0x40, it should read back data 0x41, 0x27 as waveform got, but the data read back are 0x41, 0x41.  The read back are difference to the waveform.

The code as below:

    

SysCtlPeripheralEnable( I2cMap[index].PeriphI2c );
I2CMasterEnable(ui2cBase);//I2C1_BASE
SysCtlPeripheralReset(I2cMap[index].PeriphI2c);

// Configure the I2C SCL and SDA pins for I2C operation.
SysCtlPeripheralEnable( I2cMap[index].PeriphGpio);
GPIOPinConfigure( I2cMap[index].SCL );
GPIOPinTypeI2CSCL(I2cMap[index].IoBase, I2cMap[index].IoScl);
GPIOPinConfigure( I2cMap[index].SDA );
GPIOPinTypeI2C( I2cMap[index].IoBase , I2cMap[index].IoSda) ;

ROM_I2CMasterInitExpClk(ui2cBase, ui32SysClock, true);

ROM_I2CMasterSlaveAddrSet(ui2cBase, address, false);

busy = I2CMasterBusy(ui2cBase);

//Send the first byte.
ROM_I2CMasterDataPut( ui2cBase, pData[0] );
ROM_I2CMasterControl( ui2cBase, I2C_MASTER_CMD_SINGLE_SEND );

while(ROM_I2CMasterBusy(ui2cBase)) {}

ROM_I2CMasterSlaveAddrSet(ui2cBase, address, true);

ROM_I2CMasterControl( ui2cBase, I2C_MASTER_CMD_BURST_RECEIVE_START );
while(ROM_I2CMasterBusy(ui2cBase)) {}
back1 = ROM_I2CMasterDataGet( ui2cBase );

ROM_I2CMasterControl( ui2cBase, I2C_MASTER_CMD_BURST_RECEIVE_FINISH );
while(ROM_I2CMasterBusy(ui2cBase)) {}
back2 = ROM_I2CMasterDataGet( ui2cBase );

UartOsPrintf("Read = %x, %x\n", back1, back2 );

It has result output:

Read = 41, 41 

Add waveform:

Second question:

If I remove ROM_  as below:  

SysCtlPeripheralEnable( I2cMap[index].PeriphI2c );
I2CMasterEnable(ui2cBase);//I2C2_BASE
SysCtlPeripheralReset(I2cMap[index].PeriphI2c);

// Configure the I2C SCL and SDA pins for I2C operation.
SysCtlPeripheralEnable( I2cMap[index].PeriphGpio);
GPIOPinConfigure( I2cMap[index].SCL );
GPIOPinTypeI2CSCL(I2cMap[index].IoBase, I2cMap[index].IoScl);
GPIOPinConfigure( I2cMap[index].SDA );
GPIOPinTypeI2C( I2cMap[index].IoBase , I2cMap[index].IoSda) ;

// ROM_SysCtlPeripheralEnable( I2cMap[index].PeriphI2c );

I2CMasterInitExpClk(ui2cBase, ui32SysClock, true);


I2CMasterSlaveAddrSet(ui2cBase, address, false);

busy = I2CMasterBusy(ui2cBase);

//Send the first byte.
I2CMasterDataPut( ui2cBase, pData[0] );
I2CMasterControl( ui2cBase, I2C_MASTER_CMD_SINGLE_SEND );

while(ROM_I2CMasterBusy(ui2cBase)) {}

I2CMasterSlaveAddrSet(ui2cBase, address, true);

I2CMasterControl( ui2cBase, I2C_MASTER_CMD_BURST_RECEIVE_START );
while(I2CMasterBusy(ui2cBase)) {}
back1 = I2CMasterDataGet( ui2cBase );

I2CMasterControl( ui2cBase, I2C_MASTER_CMD_BURST_RECEIVE_FINISH );
while(I2CMasterBusy(ui2cBase)) {}
back2 = I2CMasterDataGet( ui2cBase );

UartOsPrintf("Read = %x, %x\n", back1, back2 );

Then I got the waveform:

And then I2CMasterDataGet() always got 0x41.

Could you tell me what's wrong?