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.
Hi.
I am trying i2C communication with TMP275 on 28388 CM.
Write 3 bytes to TMP275, but only 2 bytes SDA.
The configuration and source code are as follows.
Where is the problem?
Source Code
// I2C Init
I2C_enableMaster(I2C0_BASE);
I2C_initMaster(I2C0_BASE,I2C_CLK_FREQ,true); // Fast mode = 400Khz
I2C_enableSlave(I2C0_BASE);
I2C_setSlaveAddress(I2C0_BASE,TMP_Address,I2C_MASTER_WRITE);
I2C_setOwnSlaveAddress(I2C0_BASE,I2C_SLAVE_ADDR_PRIMARY,TMP_Address);
I2C_configureRxFIFO(I2C0_BASE,I2C_FIFO_CFG_RX_MASTER,I2C_FIFO_CFG_RX_TRIG_1);
I2C_configureTxFIFO(I2C0_BASE,I2C_FIFO_CFG_TX_MASTER,I2C_FIFO_CFG_TX_TRIG_1);
I2C_enableFIFO(I2C0_BASE,I2C_SLAVE_RX_FIFO_ENABLE);
I2C_enableFIFO(I2C0_BASE,I2C_SLAVE_TX_FIFO_ENABLE);
I2C_enableMaster(I2C0_BASE);
// Set_Tmp275 3Byte Write
I2C_setMasterConfig( I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START );
TMP_Timeout = 10*1000;
while(I2C_isMasterBusy(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x01; return; }
}
I2C_putMasterData( I2C0_BASE, 0x01 );
TMP_Timeout = 10*1000;
while(I2C_isMasterBusy(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x02; return; }
}
TMP_Timeout = 10*1000;
while(I2C_getMasterErr(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x03; return; }
}
I2C_setMasterConfig( I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT );
TMP_Timeout = 10*1000;
while(I2C_isMasterBusy(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x04; return; }
}
TMP_Timeout = 10*1000;
while(I2C_getMasterErr(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x05; return; }
}
I2C_putMasterData( I2C0_BASE, 0x60 );
TMP_Timeout = 10*1000;
while(I2C_isMasterBusy(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x06; return; }
}
TMP_Timeout = 10*1000;
while(I2C_getMasterErr(I2C0_BASE))
{
if((TMP_Timeout--) == 0)
{ TMP_ERR=0x07; return; }
}
I2C_setMasterConfig( I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_STOP );
Thanks