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.
Dear TI,
使用280049的I2C模块和TCA9539(IO扩展)芯片进行通信。
当波特率设置到100kHz时,观察波形发现进行一段时间正常通信后,会出现无数据/无时钟的情况。
如果把波特率设置到50/10kHz,通信会一直正常,波形也正确。
具体问题是,在TCA9539发送了IO信息后,280049的I2C芯片应该先产生一个NACK位,再产生一个STOP来结束本次读取过程。出问题的时候,280049在发送了NACK位后,没有产生STOP位,反而产生了RESTART位,导致和TCA9539时序不匹配。
实际情况是刚开始是能以正确的时序进行读取的。
Uint16 I2CwriteData(volatile struct I2CMsg *msg) { Uint16 i; // // Wait until the STP bit is cleared from any previous master // communication. Clearing of this bit by the module is delayed until after // the SCD bit is set. If this bit is not checked prior to initiating a new // message, the I2C could get confused. // if(I2C_getStopConditionStatus(I2CA_BASE)) { return(ERROR_STOP_NOT_READY); } // // Setup slave address // I2C_setSlaveAddress(I2CA_BASE, SLAVE_ADDRESS); // // Check if bus busy // if(I2C_isBusBusy(I2CA_BASE)) { return(ERROR_BUS_BUSY); } // // Setup number of bytes to send msgBuffer and address // I2C_setDataCount(I2CA_BASE, (msg->numBytes + 1)); // // Setup data to send // I2C_putData(I2CA_BASE, msg->RegAddr); for (i = 0; i < msg->numBytes; i++) { I2C_putData(I2CA_BASE, msg->msgBuffer[i]); } // // Send start as master transmitter // I2C_setConfig(I2CA_BASE, I2C_MASTER_SEND_MODE); I2C_sendStartCondition(I2CA_BASE); I2C_sendStopCondition(I2CA_BASE); return(I2C_SUCCESS); }
发送函数如上,根据例程修改的。放在主函数中循环运行。
上面一共是两个问题:1.为什么置位了STP没有正常发送;2.为什么会重新START;
主要关注点在1,我想问I2C在什么情况下会不发送STOP到总线上(STP已经置位的情况下)?是否和I2CSTR.SCD位有关?