1 Reply Latest reply on Jul 23, 2018 7:48 PM by ring

    I2C Master Read from Slave Sub-Address

    bcoghlan_1547486

      Hello all,

       

      I am working with the PSoC 5LP Cy8CKIT-059 using a UDB I2C master component. I have no trouble writing to the I2C device I want to communicate with using uint8 I2C_MasterReadBuf, but after reading through the datasheet for the I2C component, I cannot figure out how to read from a sub-address of the slave.

       

      The uint8 I2C_MasterReadBuf(uint8 slaveAddress, uint8 * rdData, uint8 cnt, uint8 mode) seems to be the function I would use, but as far as I can tell from the documentation, this will only read "cnt" number of bytes starting from the I2C slave's base address. Is it possible for me to read from a sub-address? Again, I have read the datasheet and I have no been able to get an answer form that.

       

      Thanks!

       

      Brian Coghlan

        • 1. Re: I2C Master Read from Slave Sub-Address
          ring

          Brian Coghlan,

           

          I guess you use the EZ-I2C module as the slave.

          The first data (8 bit or 16 bit)  after slave address is sub-address.

          If you have configure the EZ-I2C sub-address 8bit, then the 8 bit data after the slave address is sub-address.

          If you have configure the EZ-I2C sub-address 16bit, then the 16 bit data after the slave address is sub-address.

           

          Thanks