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.

F28335 I2C读数据



I2C设置为主接受模式,调试时发现

while(!I2caRegs.I2CSTR.bit.ARDY);
while(!I2caRegs.I2CSTR.bit.SCD);

for(i=0;i<len;i++)
{
data[i]=I2caRegs.I2CDRR;
}

在读完LEN个字节后,I2C的FIFO寄存器的RXFFST4值仍然为LEN个,读出来的值就不对。请问下,数据正确接受的标志位是哪个?

  • 28335I2C模块内部框图,在非FIFO模式下有四个寄存器用于数据的发送与接收。CPU写数据到I2CDXR寄存器中发送,从I2CDRR寄存器中读取接收数据。如果I2C配置为发送方,写到I2CDXR中的数据被复制到I2CXSR中,由I2CXSR将每一位数据移位到引脚SDA上;如果I2C配置为接收方,移位到I2CRSR中的数据将会复制到I2CDRR寄存器中。