7 Replies Latest reply on Apr 10, 2013 7:49 AM by user_276445525

    I2C master , help me

    user_276445525

      1.  i call the function  I2C_M_Start();

         

      2.  write a data buf to eeprom:

         

                I2C_M_MasterWriteBuf(SLAVE_ADDR, buf, num, I2C_M_MODE_COMPLETE_XFER);
                 
                  /* Wait till write operation is complete*/
                  while (!(I2C_M_MasterStatus() & I2C_M_MSTAT_WR_CMPLT))
                  {
                      ;
                  }

         

                  //the buf includes the address of eeprom memory.

         

      3. write another data buf to eeprom:

         

                  I2C_M_MasterWriteBuf(SLAVE_ADDR, anotherbuf, num1, I2C_M_MODE_COMPLETE_XFER);
                 
                  /* Wait till write operation is complete*/
                  while (!(I2C_M_MasterStatus() & I2C_M_MSTAT_WR_CMPLT))
                  {
                      ;
                  }

         

      4.  i call the function  I2C_M_Stopt();

         

      my question :

         

      2 worked     3 did not work

         

      when i commented 2,  the 3 woked.

         

      maybe  i was wrong about the mode(now is I2C_M_MODE_COMPLETE_XFER).