Part Number:TMS570LS3137
使用下面的代码对AT32C256 EEPROM读取数据,发现在第二次start信号前多发了stop信号,但是数据貌似也读出来了没问题。如何能不让这个stop信号产生?
uint8_t RX_Data_Master[10]={0xaa,0xbb};
/* wait until MST bit gets cleared, this takes
* few cycles after Bus Busy is cleared */
// while(i2cIsMasterReady(i2cREG1) != true);
/* Configure address of Slave to talk to */
i2cSetSlaveAdd(i2cREG1, SLA_ADDR);
/* Set direction to Transmitter */
/* Note: Optional – It is done in Init */
i2cSetDirection(i2cREG1, I2C_TRANSMITTER);
/* Configure Data count */
/* Slave address + Word address write operation before reading */
i2cSetCount(i2cREG1, 2);
/* Set mode as Master */
i2cSetMode(i2cREG1, I2C_MASTER);
/* Set Stop after programmed Count */
i2cSetStop(i2cREG1);
/* Transmit Start Condition */
i2cSetStart(i2cREG1);
/* Send the Word Address */
i2cSendByte(i2cREG1, 0x00);
i2cSendByte(i2cREG1, 0x10);
/* 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);
/*****************************************/
/*****************************************/
/* wait until MST bit gets cleared, this takes
* few cycles after Bus Busy is cleared */
while(i2cIsMasterReady(i2cREG1) != true);
/* Configure address of Slave to talk to */
i2cSetSlaveAdd(i2cREG1, SLA_ADDR);
/* Set direction to receiver */
i2cSetDirection(i2cREG1, I2C_RECEIVER);
/* Configure Data count */
/* Note: Optional – It is done in Init, unless user want to change */
i2cSetCount(i2cREG1, 5);
/* Set mode as Master */
i2cSetMode(i2cREG1, I2C_MASTER);
/* Set Stop after programmed Count */
/* Transmit Start Condition */
i2cSetStart(i2cREG1);
/* Tranmit DATA_COUNT number of data in Polling mode */
i2cReceive(i2cREG1, 5, RX_Data_Master);
i2cSetStop(i2cREG1);
/* 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);
Annie Liu:
感谢您对TI产品的关注!为更加有效地解决您的问题,您的问题已经发布在E2E英文技术论坛上,将由资深的英文论坛工程师为您提供帮助。您也可以查看下帖了解进展:
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1136501/tms570ls3137-i2c-problem
,
Annie Liu:
正确写入地址后,您在代码中给出stop条件,因为仅生成stop条件,请参见下面标出的函数
因此,请删除以下标出的内容并进行测试: