请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS570LS1227 大家好、
以下是客户提出的问题、可能需要您的帮助:
1) 1) 已在引脚多路复用器中选择 I2C 引脚:
2) 2)在 I2C 配置中、启用 I2C 引脚作为 I2C 功能:
3) 3)有一个外部2.2K 上拉电阻器。
4) 4)发送一个字节的数据后、START 信号由示波器进行监控、但不会监控 END 信号。 在1秒间隔后、当再次发送一个字节时、发现程序卡在
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) 5) 示波器捕获的波形信号如下:
6) 6) 仿真 I2C 的程序可以正确地从从 DS1339读取数据。
您可以帮助检查此案例吗? 谢谢。
此致、
樱桃