TI中文支持网
TI专业的中文技术问题搜集分享网站

I2C

Eric ,

请教一下,读I2C的地址,修改地址,我读出来的值,一直不变,为什么啊

if(msg->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP)
   {
      // Check if bus busy
      if (I2caRegs.I2CSTR.bit.BB == 1)
      {
         return I2C_BUS_BUSY_ERROR;
      }
      I2caRegs.I2CCNT = 2;
      I2caRegs.I2CDXR = msg->MemoryHighAddr;
      I2caRegs.I2CDXR = msg->MemoryLowAddr;
      I2caRegs.I2CMDR.all = 0x2620;   // Send data to setup EEPROM address
   }
   else if(msg->MsgStatus == I2C_MSGSTAT_RESTART)
   {
      I2caRegs.I2CCNT = msg->NumOfBytes; // Setup how many bytes to expect
      I2caRegs.I2CMDR.all = 0x2C20;   // Send restart as master receiver
   }

peter shi:

I2C的地址有8位和16位之分

Eric ,

请教一下,读I2C的地址,修改地址,我读出来的值,一直不变,为什么啊

if(msg->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP)
   {
      // Check if bus busy
      if (I2caRegs.I2CSTR.bit.BB == 1)
      {
         return I2C_BUS_BUSY_ERROR;
      }
      I2caRegs.I2CCNT = 2;
      I2caRegs.I2CDXR = msg->MemoryHighAddr;
      I2caRegs.I2CDXR = msg->MemoryLowAddr;
      I2caRegs.I2CMDR.all = 0x2620;   // Send data to setup EEPROM address
   }
   else if(msg->MsgStatus == I2C_MSGSTAT_RESTART)
   {
      I2caRegs.I2CCNT = msg->NumOfBytes; // Setup how many bytes to expect
      I2caRegs.I2CMDR.all = 0x2C20;   // Send restart as master receiver
   }

Eric panda:

我也是这个问题,在EEPROM的同一个块里的地址,读出的都不变,比如:我的EEPROM地址空间:0x0-0xFFF,有八个块,我再读写第一个块的时候,读出来的一直是我最后一次写进入的数,不论我读的是哪个地址。

你要是解决了,麻烦告诉我下。谢啦!

赞(0)
未经允许不得转载:TI中文支持网 » I2C
分享到: 更多 (0)