I2C Master Read from Slave Sub-Address

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BrCo_1547486
Level 2
Level 2
First like received First like given Welcome!

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

0 Likes
1 Solution
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

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

View solution in original post

0 Likes
1 Reply
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

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

0 Likes