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.

F28035 I2C查询方式操作AT24C04失败

您好:

我在使用F28035操作AT24C04的时候,发现一个问题,就是写EEPROM之后,立刻读取EEPROM内容,使用查询方式的时候,I2C状态寄存器会没有反应,例如

 I2caRegs.I2CMDR.all = 0x2620;   // Send data to setup EEPROM address

执行之后,如果我查询ARDY标志位,发现没有反应,也就是说,ARDY没有设置为1,不知道是不是写法的问题,参考手册说,只要完成,就立刻给信号,但确实没给出,死在for循环里面了。

 for(;;)  {   tmp++;   if (I2caRegs.I2CSTR.bit.ARDY == 1)   {    if(I2caRegs.I2CSTR.bit.NACK == 1)       {     I2caRegs.I2CMDR.bit.STP = 1;           I2caRegs.I2CSTR.all = I2C_CLR_NACK_BIT;     I2caRegs.I2CFFTX.bit.TXFFRST = 0;     I2caRegs.I2CFFTX.bit.TXFFRST = 1;           flag = 0xff;       }       else       {        I2caRegs.I2CCNT = 1; // Setup how many bytes to expect        I2caRegs.I2CMDR.all = 0x2C20;   // Send restart as master receiver       }    break;   }

 }