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.
请教TMS570LS1227的 I2C使用问题:
1,我在pinmux中已经选择了I2C的引脚
2,在I2C配置中使能了I2C的引脚为I2C功能
3,外部有2.2K的上拉电阻,
4,发送一个字节的数据后,通过示波器监测到了,启动信号,却没有监测到结束信号,在间隔1s的时长以后,再次发送一个自己的时候,发现程序卡在了
while(i2cIsStopDetected(i2cREG1) == 0);代码处。函数的发送代码如下
void i2c_send_test(void)
{
int32_t delay=0;
/* Configure address of Slave to talk to */
i2cSetSlaveAdd(i2cREG1, Slave_Address);
/* Set direction to Transmitter */
/* Note: Optional - It is done in Init */
i2cSetDirection(i2cREG1, I2C_TRANSMITTER);
/* Configure Data count */
/* Note: Optional - It is done in Init, unless user want to change */
i2cSetCount(i2cREG1, 1);
/* Set mode as Master */
i2cSetMode(i2cREG1, I2C_MASTER);
/* Set Stop after programmed Count */
i2cSetStop(i2cREG1);
/* Transmit Start Condition */
i2cSetStart(i2cREG1);
/* Tranmit DATA_COUNT number of data in Polling mode */
i2cSend(i2cREG1, 1, TX_Data_Master);
/* Wait until Bus Busy is cleared */
while(i2cIsBusBusy(i2cREG1) == true);
/* Wait until Stop is detected */
while(i2cIsStopDetected(i2cREG1) == 0);
/* Clear the Stop condition */
i2cClearSCD(i2cREG1);
/* Simple Dealya before starting Next Block */
/* Depends on how quick the Slave gets ready */
for(delay=0;delay<1000000;delay++);
}
5,通过示波器抓取的波形信号如下图:
6,我通过gpio模拟I2C的程序可以正确读取从设备DS1339的数据。
求高手指点,这是什么情况,在线等...................
您好,
工程师也验证了"i2c_send_test"函数中的代码,目前没发现什么问题。您试下在"i2c_send_test"函数之前调用"i2cInit"函数。
同时请使用以下 i2c 引脚配置进行测试: