Hi to all,
I have a problem with the I2C2 bus of the Sitara AM3352. For each shipment data is only sent the slave address, but the data is not sent. My application is pooling, without using the interrupt. From my slave receive the ACK bit, but does not mandate any byte from the software. I attach below my simple application.
...
/* Enable clock I2C_2 */
I2C2ModuleClkConfigEn();
/* Setting pin for I2C2 */
PinMuxSetupApp();
...
/* INIT */
/* Put i2c in reset/disabled state */
I2CMasterDisable(SOC_I2C_2_REGS);
I2CSoftReset(SOC_I2C_2_REGS);
/* Disable auto Idle functionality */
I2CAutoIdleDisable(SOC_I2C_2_REGS);
/* Configure i2c bus speed to 100khz */
I2CMasterInitExpClk(SOC_I2C_2_REGS, I2C_SYSTEM_CLOCK, I2C_INTERNAL_CLOCK,
I2C_OUTPUT_CLOCK);
I2CMasterEnable(SOC_I2C_2_REGS);
while(!I2CSystemStatusGet(SOC_I2C_2_REGS));
/* ADDRESSS */
I2CMasterSlaveAddrSet(SOC_I2C_2_REGS, 0xD0);
/* WRITE */
dcount = 3u;
tCount = 0u;
dataToSlave[0]=0xF1;
dataToSlave[1]=0x71;
dataToSlave[2]=0x28;
while(1UL)
{
I2CSetDataCount(SOC_I2C_2_REGS, dcount);
I2CMasterIntClearEx(SOC_I2C_2_REGS, 0x7FF);
I2CMasterControl(SOC_I2C_2_REGS, I2C_CFG_MST_TX);
I2CMasterStart(SOC_I2C_2_REGS);
while(I2CMasterBusBusy(SOC_I2C_2_REGS) == 0);
// while((I2C_INT_TRANSMIT_READY == (I2CMasterIntRawStatus(SOC_I2C_2_REGS)
// & I2C_INT_TRANSMIT_READY)) && dcount--)
// {
// I2CMasterDataPut(SOC_I2C_2_REGS, dataToSlave[tCount++]);
//
// I2CMasterIntClearEx(SOC_I2C_2_REGS, I2C_INT_TRANSMIT_READY);
// }
/* Wait for the Tx register to be empty */
while (0 == I2CMasterIntRawStatusEx(SOC_I2C_2_REGS, I2C_INT_TRANSMIT_READY));
I2CMasterDataPut(SOC_I2C_2_REGS, dataToSlave[tCount++]);
/* Wait for the Tx register to be empty */
while (0 == I2CMasterIntRawStatusEx(SOC_I2C_2_REGS, I2C_INT_TRANSMIT_READY));
I2CMasterStop(SOC_I2C_2_REGS);
while(0 == (I2CMasterIntRawStatus(SOC_I2C_2_REGS) & I2C_INT_STOP_CONDITION));
I2CMasterIntClearEx(SOC_I2C_2_REGS, I2C_INT_STOP_CONDITION);
dcount = 3u;
tCount = 0u;
mLed4Off();
mDelayFunc();
mLed4On();
mDelayFunc();
}
return (EXIT_SUCCESS);
}
Can anyone tell me where am I wrong?
Thanks to all
Marco T