3 Replies Latest reply on Jun 27, 2018 12:22 PM by arksc_3096881

    CYPD-3125 I2C line usage

      Facing issue in using I2C line between PSOC CYPD-3125 and Cross Bar I2C device.  Using PSOc creator to create I2C master component and followed some of the sample with developement kit but I2C read write is not success. API return success but written value is not reflected on device register. Can you provide any suggestion to overcome the issue.

       

      Build version shows 3.10 . Within I2C Driver code its observed there are some piece of code specific to version #if (MUX_CTRL_CY_SCBIP_V0) so do i need to look any Psoc creator specific CYPD-3125 SDK to overcome the issue.

       

      Thank you,

       

      uint8_t I2CDeviceReadReg(uint8_t reg)

      {

           uint8_t writebuf[1]={0x0};

          uint8_t readbuf[1]={0};

          writebuf[0]=reg;

      .......

       

              MUX_CTRL_I2CMasterWriteBuf(ADDR,(uint8_t*)writebuf,1,MUX_CTRL_I2C_MODE_NO_STOP);

              while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_WR_CMPLT)==0){};

              MUX_CTRL_I2CMasterReadBuf(ADDR,(uint8_t*)readbuf,1,MUX_CTRL_I2C_MODE_REPEAT_START);

              while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_RD_CMPLT)==0){};

      ................      

      return 0;

      }

       

      void I2CDeviceWriteReg(uint8_t reg,uint8_t value)

      {

          uint8_t writebuf[2]={0};

        

          writebuf[0]=reg;

          writebuf[1]=value;

        

          MUX_CTRL_I2CMasterWriteBuf(ADDR,writebuf,2,MUX_CTRL_I2C_MODE_COMPLETE_XFER);

          while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_WR_CMPLT)==0){};

        

          return;

        

      }